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 <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20240508035301.1554434-4-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent de6a908 commit 45b4f40

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)