summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorGaurav Singh <gaurav1086@gmail.com>2020-06-08 13:18:17 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-06-09 12:40:04 -0300
commit11b6e5482e178055ec1f2444b55f2518713809d1 (patch)
treeafa7780404b16ed2e109ad5a5a436943e8807931 /tools/perf
parentdd76c302955de405ea589e36c574f6f10eca99b6 (diff)
perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events()
The 'evname' variable can be NULL, as it is checked a few lines back, check it before using. Fixes: 9e207ddfa207 ("perf report: Show call graph from reference events") Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/ Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-report.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b63b3fb2de70..5f1d2a878fad 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -478,8 +478,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
if (rep->time_str)
ret += fprintf(fp, " (time slices: %s)", rep->time_str);
- if (symbol_conf.show_ref_callgraph &&
- strstr(evname, "call-graph=no")) {
+ if (symbol_conf.show_ref_callgraph && evname && strstr(evname, "call-graph=no")) {
ret += fprintf(fp, ", show reference callgraph");
}