public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ian Munsie <imunsie@au1.ibm.com>
Subject: [PATCH 02/10] tracing/syscalls: Convert redundant syscall_nr checks into WARN_ON
Date: Tue, 08 Feb 2011 17:16:14 -0500	[thread overview]
Message-ID: <20110208221719.309444699@goodmis.org> (raw)
In-Reply-To: 20110208221612.084294240@goodmis.org

[-- Attachment #1: 0002-tracing-syscalls-Convert-redundant-syscall_nr-checks.patch --]
[-- Type: text/plain, Size: 2109 bytes --]

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>
LKML-Reference: <1296703645-18718-3-git-send-email-imunsie@au1.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 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 a9ceabd..4230942 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -359,7 +359,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)
@@ -377,7 +377,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--;
@@ -393,7 +393,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)
@@ -411,7 +411,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-08 22:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08 22:16 [PATCH 00/10] [GIT PULL][v2.6.39] tracing: updates Steven Rostedt
2011-02-08 22:16 ` [PATCH 01/10] tracing/syscalls: Dont add events for unmapped syscalls Steven Rostedt
2011-02-08 22:16 ` Steven Rostedt [this message]
2011-02-08 22:16 ` [PATCH 03/10] tracing/syscalls: Make arch_syscall_addr weak Steven Rostedt
2011-02-08 22:16 ` [PATCH 04/10] tracing/syscalls: Allow arch specific syscall symbol matching Steven Rostedt
2011-02-08 22:16 ` [PATCH 05/10] tracing/syscalls: Early terminate search for sys_ni_syscall Steven Rostedt
2011-02-08 22:16 ` [PATCH 06/10] tracing: Add unstable sched clock note to the warning Steven Rostedt
2011-02-08 22:16 ` [PATCH 07/10] trivial: Fix Stevens Copyright typos Steven Rostedt
2011-02-08 22:16 ` [PATCH 08/10] tracing: Compile time initialization for event flags value Steven Rostedt
2011-02-08 22:16 ` [PATCH 09/10] tracing: Remove obsolete sched_switch tracer Steven Rostedt
2011-02-14 19:42   ` Steven Rostedt
2011-02-08 22:16 ` [PATCH 10/10] tracing: Deprecate tracing_enabled for tracing_on Steven Rostedt
2011-02-17 13:50 ` [PATCH 00/10] [GIT PULL][v2.6.39] tracing: updates Ingo Molnar
2011-02-17 14:04   ` Ingo Molnar
2011-02-17 14:55     ` Ingo Molnar
2011-02-17 15:03     ` 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=20110208221719.309444699@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=imunsie@au1.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox