Skip to content

Commit

Permalink
tracing/syscalls: Convert redundant syscall_nr checks into WARN_ON
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ian Munsie authored and Steven Rostedt committed Feb 8, 2011
1 parent ba97697 commit 3773b38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/trace/trace_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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--;
Expand All @@ -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)
Expand All @@ -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--;
Expand Down

0 comments on commit 3773b38

Please sign in to comment.