LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Ian Munsie" <imunsie@au1.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Andreas Dilger <adilger@dilger.ca>,
	Dave Kleikamp <shaggy@linux.vnet.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jiri Kosina <jkosina@suse.cz>, Jason Baron <jbaron@redhat.com>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Alexander Graf <agraf@suse.de>, Ingo Molnar <mingo@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Scott Wood <scottwood@freescale.com>,
	Nathan Lynch <ntl@pobox.com>,
	Avantika Mathur <mathur@linux.vnet.ibm.com>,
	David Gibson <dwg@au1.ibm.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Namhyung Kim <namhyung@gmail.com>,
	Ian Munsie <imunsie@au1.ibm.com>
Subject: [PATCH 2/6] ftrace syscalls: Convert redundant syscall_nr checks into WARN_ON
Date: Thu,  3 Feb 2011 14:27:21 +1100	[thread overview]
Message-ID: <1296703645-18718-3-git-send-email-imunsie@au1.ibm.com> (raw)
In-Reply-To: <1296703645-18718-1-git-send-email-imunsie@au1.ibm.com>

From: Ian Munsie <imunsie@au1.ibm.com>

With the ftrace events now checking if the syscall_nr is valid upon
initialisation it should no longer be possible to register or unregister
a syscall event without a valid syscall_nr since they should not be
created. This adds a WARN_ON_ONCE in the register and unregister
functions to locate potential regressions in the future.

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
 kernel/trace/trace_syscalls.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index a66bc13..1a6e8dd 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -358,7 +358,7 @@ int reg_event_syscall_enter(struct ftrace_event_call *call)
 	int num;
 
 	num = ((struct syscall_metadata *)call->data)->syscall_nr;
-	if (num < 0 || num >= NR_syscalls)
+	if (WARN_ON_ONCE(num < 0 || num >= NR_syscalls))
 		return -ENOSYS;
 	mutex_lock(&syscall_trace_lock);
 	if (!sys_refcount_enter)
@@ -376,7 +376,7 @@ void unreg_event_syscall_enter(struct ftrace_event_call *call)
 	int num;
 
 	num = ((struct syscall_metadata *)call->data)->syscall_nr;
-	if (num < 0 || num >= NR_syscalls)
+	if (WARN_ON_ONCE(num < 0 || num >= NR_syscalls))
 		return;
 	mutex_lock(&syscall_trace_lock);
 	sys_refcount_enter--;
@@ -392,7 +392,7 @@ int reg_event_syscall_exit(struct ftrace_event_call *call)
 	int num;
 
 	num = ((struct syscall_metadata *)call->data)->syscall_nr;
-	if (num < 0 || num >= NR_syscalls)
+	if (WARN_ON_ONCE(num < 0 || num >= NR_syscalls))
 		return -ENOSYS;
 	mutex_lock(&syscall_trace_lock);
 	if (!sys_refcount_exit)
@@ -410,7 +410,7 @@ void unreg_event_syscall_exit(struct ftrace_event_call *call)
 	int num;
 
 	num = ((struct syscall_metadata *)call->data)->syscall_nr;
-	if (num < 0 || num >= NR_syscalls)
+	if (WARN_ON_ONCE(num < 0 || num >= NR_syscalls))
 		return;
 	mutex_lock(&syscall_trace_lock);
 	sys_refcount_exit--;
-- 
1.7.2.3


  parent reply	other threads:[~2011-02-03  3:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03  3:27 PowerPC, ftrace: Add PPC raw syscall tracepoints & ftrace fixes (mimimal subset only) v4 Ian Munsie
2011-02-03  3:27 ` [PATCH 1/6] ftrace syscalls: don't add events for unmapped syscalls Ian Munsie
2011-02-17 14:58   ` [tip:perf/core] tracing/syscalls: Don't " tip-bot for Ian Munsie
2011-02-03  3:27 ` Ian Munsie [this message]
2011-02-17 14:59   ` [tip:perf/core] tracing/syscalls: Convert redundant syscall_nr checks into WARN_ON tip-bot for Ian Munsie
2011-02-03  3:27 ` [PATCH 3/6] ftrace syscalls: Make arch_syscall_addr weak Ian Munsie
2011-02-17 14:59   ` [tip:perf/core] tracing/syscalls: " tip-bot for Ian Munsie
2011-02-03  3:27 ` [PATCH 4/6] ftrace syscalls: Allow arch specific syscall symbol matching Ian Munsie
2011-02-17 14:59   ` [tip:perf/core] tracing/syscalls: " tip-bot for Ian Munsie
2011-02-03  3:27 ` [PATCH 5/6] ftrace, powerpc: Implement raw syscall tracepoints on PowerPC Ian Munsie
2011-02-08  2:10   ` Steven Rostedt
2011-02-08 10:07     ` Benjamin Herrenschmidt
2011-02-08 16:54       ` Steven Rostedt
2011-02-03  3:27 ` [PATCH 6/6] ftrace syscalls: Early terminate search for sys_ni_syscall Ian Munsie
2011-02-17 15:00   ` [tip:perf/core] tracing/syscalls: " tip-bot for Ian Munsie
2011-02-08  2:10 ` PowerPC, ftrace: Add PPC raw syscall tracepoints & ftrace fixes (mimimal subset only) v4 Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296703645-18718-3-git-send-email-imunsie@au1.ibm.com \
    --to=imunsie@au1.ibm.com \
    --cc=adilger@dilger.ca \
    --cc=agraf@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=dwg@au1.ibm.com \
    --cc=fweisbec@gmail.com \
    --cc=jbaron@redhat.com \
    --cc=jkosina@suse.cz \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mathur@linux.vnet.ibm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@gmail.com \
    --cc=ntl@pobox.com \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=schwab@linux-m68k.org \
    --cc=scottwood@freescale.com \
    --cc=shaggy@linux.vnet.ibm.com \
    --subject='Re: [PATCH 2/6] ftrace syscalls: Convert redundant syscall_nr checks into WARN_ON' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).