Commit-ID:  d0d3913895e5b50623bd4dafd876e41c1169031d
Gitweb:     http://git.kernel.org/tip/d0d3913895e5b50623bd4dafd876e41c1169031d
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 14 Aug 2012 10:57:03 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 14 Aug 2012 10:36:30 -0300

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 <[email protected]>
Cc: Feng Tang <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: 
http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/util/trace-event-parse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/trace-event-parse.c 
b/tools/perf/util/trace-event-parse.c
index 4cb7f38..a5a554e 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) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to