summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGaurav Singh <gaurav1086@gmail.com>2020-06-08 13:18:17 -0300
committerSasha Levin <sashal@kernel.org>2020-06-30 15:38:30 -0400
commit0f61e86bcc0b3ca51b45ae01fbdfdfea0c0b7fe7 (patch)
treef9acabf72be9f1edae93946445505c035870c899 /tools
parent104592a5233d77322c3e527e3925dc7c5a30a6af (diff)
downloadlinux-stable-0f61e86bcc0b3ca51b45ae01fbdfdfea0c0b7fe7.tar.gz
linux-stable-0f61e86bcc0b3ca51b45ae01fbdfdfea0c0b7fe7.tar.bz2
linux-stable-0f61e86bcc0b3ca51b45ae01fbdfdfea0c0b7fe7.zip
perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events()
[ Upstream commit 11b6e5482e178055ec1f2444b55f2518713809d1 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-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 0abca8783bb3..78485edb9467 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -341,8 +341,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
if (evname != NULL)
ret += fprintf(fp, " of event '%s'", evname);
- 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");
}