From: Namhyung Kim Date: Tue, 14 Aug 2012 01:57:03 +0000 (+0900) Subject: perf script: Fix a NULL pointer dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d0d3913895e5b50623bd4dafd876e41c1169031d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git perf script: Fix a NULL pointer dereference If 'perf script --gen-script' was called with a perf.data which contains no tracepoint event, it'd segfault due to NULL pevent pointer. Fix it. Signed-off-by: Namhyung Kim Cc: Feng Tang Cc: Ingo Molnar Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1344909423-26384-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 4cb7f3831f78..a5a554efeb50 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c @@ -293,7 +293,7 @@ struct event_format *trace_find_next_event(struct pevent *pevent, { static int idx; - if (!pevent->events) + if (!pevent || !pevent->events) return NULL; if (!event) {