Skip to content

Commit 2a2a7f5

Browse files
captain5050acmel
authored andcommitted
perf pmu: Avoid segv for missing name/alias_name in wildcarding
The pmu name or alias_name fields may be NULL and should be skipped if so. This is done in all loops of perf_pmu___name_match except the final wildcard loop which was an oversight. Fixes: 63e2871 ("perf pmu: Rename name matching for no suffix or wildcard variants") Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> 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@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20250527215035.187992-1-irogers@google.com [ Fixup the Fixes: tag to the right commit ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4c04654 commit 2a2a7f5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/perf/util/pmu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,9 @@ static bool perf_pmu___name_match(const struct perf_pmu *pmu, const char *to_mat
21432143
for (size_t i = 0; i < ARRAY_SIZE(names); i++) {
21442144
const char *name = names[i];
21452145

2146+
if (!name)
2147+
continue;
2148+
21462149
if (wildcard && perf_pmu__match_wildcard_uncore(name, to_match))
21472150
return true;
21482151
if (!wildcard && perf_pmu__match_ignoring_suffix_uncore(name, to_match))

0 commit comments

Comments
 (0)