perf script: Fix a NULL pointer dereference
Namhyung Kim
maintainerPATCH 1/1 perf script: Fix a NULL pointer dereference
From: Namhyung Kim <[email protected]>
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.
Cc Feng Tang <[email protected]>
Signed-off-by Namhyung Kim <[email protected]>
--- tools/perf/util/trace-event-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/trace-event-parse.c +1 -1
@@ -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) {
Signature · 1 line
1.7.11.2
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]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/util/trace-event-parse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/trace-event-parse.c +1 -1
@@ -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) {