aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-sched.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-10-17 02:43:17 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-17 03:29:10 -0400
commitf39cdf25bf77219676ec5360980ac40b1a7e144a (patch)
tree2143a3653933efc5ffacea647ce8be72952b3a44 /tools/perf/builtin-sched.c
parent434a83c3fbb951908a3a52040f7f0e0b8ba00dd0 (diff)
perf tools: Move dereference after NULL test
In each case, if the NULL test on thread is needed, then the dereference should be after the NULL test. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // <smpl> @match exists@ expression x, E; identifier fld; @@ * x->fld ... when != \(x = E\|&x\) * x == NULL // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> LKML-Reference: <Pine.LNX.4.64.0910170842500.9213@ask.diku.dk> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r--tools/perf/builtin-sched.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index c9c68563e964..57ad3f458ef5 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1667,14 +1667,14 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
1667 (void *)(long)ip, 1667 (void *)(long)ip,
1668 (long long)period); 1668 (long long)period);
1669 1669
1670 dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
1671
1672 if (thread == NULL) { 1670 if (thread == NULL) {
1673 eprintf("problem processing %d event, skipping it.\n", 1671 eprintf("problem processing %d event, skipping it.\n",
1674 event->header.type); 1672 event->header.type);
1675 return -1; 1673 return -1;
1676 } 1674 }
1677 1675
1676 dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
1677
1678 if (profile_cpu != -1 && profile_cpu != (int) cpu) 1678 if (profile_cpu != -1 && profile_cpu != (int) cpu)
1679 return 0; 1679 return 0;
1680 1680