summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2024-02-24 04:14:20 +0300
committerNamhyung Kim <namhyung@kernel.org>2024-03-01 00:40:13 +0300
commit97b6b4ac1c5dd42a473a4f8e775d97476c5da038 (patch)
treefecfe26bbfbf23802a216c30738863eff9d626b0 /tools/perf
parentd4be39cadef0dbba6667a96e8e7857d510ed4e20 (diff)
downloadlinux-97b6b4ac1c5dd42a473a4f8e775d97476c5da038.tar.xz
perf metrics: Fix segv for metrics with no events
A metric may have no events, for example, the transaction metrics on x86 are dependent on there being TSX events. Fix a segv where an evsel of NULL is dereferenced for a metric leader value. Fixes: a59fb796a36b ("perf metrics: Compute unmerged uncore metrics individually") Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240224011420.3066322-2-irogers@google.com
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/metricgroup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 2d6865c392ef..79ef6095ab28 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -44,7 +44,7 @@ struct metric_event *metricgroup__lookup(struct rblist *metric_events,
if (!metric_events)
return NULL;
- if (evsel->metric_leader)
+ if (evsel && evsel->metric_leader)
me.evsel = evsel->metric_leader;
nd = rblist__find(metric_events, &me);
if (nd)