perf report: Avoid SEGV in report__setup_sample_type()
authorIan Rogers <irogers@google.com>
Wed, 8 May 2024 03:53:00 +0000 (20:53 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 9 May 2024 21:14:39 +0000 (18:14 -0300)
commit45b4f402a6b782352c4bafcff682bfb01da9ca05
tree7febfbff606298f997a605fb8416c617ff2d8d52
parentde6a908384fb1a8327ba46a2baec67d1dfe9a3e1
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: ccb17caecfbd542f ("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>
tools/perf/builtin-report.c