Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162591AbbKTMCi (ORCPT ); Fri, 20 Nov 2015 07:02:38 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:34701 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759974AbbKTMCg (ORCPT ); Fri, 20 Nov 2015 07:02:36 -0500 From: Dmitry Safonov <0x7f454c46@gmail.com> To: rostedt@goodmis.org, mingo@redhat.com Cc: linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com> Subject: [PATCH 2/2] trace_syscalls: cleanup: check syscall_nr with syscall_nr_to_meta Date: Fri, 20 Nov 2015 15:03:09 +0300 Message-Id: <1448020989-25400-2-git-send-email-0x7f454c46@gmail.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1448020989-25400-1-git-send-email-0x7f454c46@gmail.com> References: <1448020989-25400-1-git-send-email-0x7f454c46@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3159 Lines: 100 As syscall_nr_to_meta already checks for (syscall_nr < 0 || syscall_nr >= NR_syscalls) - remove this checkups. Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com> --- kernel/trace/trace_syscalls.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index b9d4c3cc60aeba..7dc58306de1a3f 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c @@ -305,7 +305,8 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id) int size; syscall_nr = trace_get_syscall_nr(current, regs); - if (syscall_nr < 0 || syscall_nr >= NR_syscalls) + sys_data = syscall_nr_to_meta(syscall_nr); + if (!sys_data) return; /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE) */ @@ -316,10 +317,6 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id) if (trace_trigger_soft_disabled(trace_file)) return; - sys_data = syscall_nr_to_meta(syscall_nr); - if (!sys_data) - return; - size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args; local_save_flags(irq_flags); @@ -352,7 +349,8 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret) int syscall_nr; syscall_nr = trace_get_syscall_nr(current, regs); - if (syscall_nr < 0 || syscall_nr >= NR_syscalls) + sys_data = syscall_nr_to_meta(syscall_nr); + if (!sys_data) return; /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE()) */ @@ -363,10 +361,6 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret) if (trace_trigger_soft_disabled(trace_file)) return; - sys_data = syscall_nr_to_meta(syscall_nr); - if (!sys_data) - return; - local_save_flags(irq_flags); pc = preempt_count(); @@ -556,15 +550,13 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) int size; syscall_nr = trace_get_syscall_nr(current, regs); - if (syscall_nr < 0 || syscall_nr >= NR_syscalls) - return; - if (!test_bit(syscall_nr, enabled_perf_enter_syscalls)) - return; - sys_data = syscall_nr_to_meta(syscall_nr); if (!sys_data) return; + if (!test_bit(syscall_nr, enabled_perf_enter_syscalls)) + return; + head = this_cpu_ptr(sys_data->enter_event->perf_events); if (hlist_empty(head)) return; @@ -630,15 +622,13 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) int size; syscall_nr = trace_get_syscall_nr(current, regs); - if (syscall_nr < 0 || syscall_nr >= NR_syscalls) - return; - if (!test_bit(syscall_nr, enabled_perf_exit_syscalls)) - return; - sys_data = syscall_nr_to_meta(syscall_nr); if (!sys_data) return; + if (!test_bit(syscall_nr, enabled_perf_exit_syscalls)) + return; + head = this_cpu_ptr(sys_data->exit_event->perf_events); if (hlist_empty(head)) return; -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/