Skip to content

Commit 45b4f40

Browse files
captain5050acmel
authored andcommitted
perf report: Avoid SEGV in report__setup_sample_type()
In some cases evsel->name is lazily initialized in evsel__name(). If not initialized passing NULL to strstr() leads to a SEGV. Fixes: ccb17ca ("perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event") Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent de6a908 commit 45b4f40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/builtin-report.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static int report__setup_sample_type(struct report *rep)
429429
* compatibility, set the bit if it's an old perf data file.
430430
*/
431431
evlist__for_each_entry(session->evlist, evsel) {
432-
if (strstr(evsel->name, "arm_spe") &&
432+
if (strstr(evsel__name(evsel), "arm_spe") &&
433433
!(sample_type & PERF_SAMPLE_DATA_SRC)) {
434434
evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC;
435435
sample_type |= PERF_SAMPLE_DATA_SRC;

0 commit comments

Comments
 (0)