Skip to content

Commit

Permalink
perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample…
Browse files Browse the repository at this point in the history
…_events()

The 'evname' variable can be NULL, as it is checked a few lines back,
check it before using.

Fixes: 9e207dd ("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>
  • Loading branch information
Gaurav Singh authored and Arnaldo Carvalho de Melo committed Jun 9, 2020
1 parent dd76c30 commit 11b6e54
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down

0 comments on commit 11b6e54

Please sign in to comment.