Skip to content

Commit 97b6b4a

Browse files
captain5050namhyung
authored andcommitted
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: a59fb79 ("perf metrics: Compute unmerged uncore metrics individually") Signed-off-by: Ian Rogers <[email protected]> Reviewed-by: Kan Liang <[email protected]> Signed-off-by: Namhyung Kim <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d4be39c commit 97b6b4a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/util/metricgroup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct metric_event *metricgroup__lookup(struct rblist *metric_events,
4444
if (!metric_events)
4545
return NULL;
4646

47-
if (evsel->metric_leader)
47+
if (evsel && evsel->metric_leader)
4848
me.evsel = evsel->metric_leader;
4949
nd = rblist__find(metric_events, &me);
5050
if (nd)

0 commit comments

Comments
 (0)