Skip to content

Commit 6c73f81

Browse files
captain5050acmel
authored andcommitted
perf metrics: Fix SEGV with --for-each-cgroup
Ensure the metric threshold is copied correctly or else a use of uninitialized memory happens. Fixes: d0a3052 ("perf metric: Compute and print threshold values") Reported-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Ian Rogers <irogers@google.com> Tested-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: Jiri Olsa <jolsa@kernel.org> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20230505204119.3443491-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent a887466 commit 6c73f81

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/util/metricgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,7 @@ int metricgroup__copy_metric_events(struct evlist *evlist, struct cgroup *cgrp,
17301730
return -ENOMEM;
17311731

17321732
new_expr->metric_expr = old_expr->metric_expr;
1733+
new_expr->metric_threshold = old_expr->metric_threshold;
17331734
new_expr->metric_name = strdup(old_expr->metric_name);
17341735
if (!new_expr->metric_name)
17351736
return -ENOMEM;

0 commit comments

Comments
 (0)