aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/pmu.c
diff options
context:
space:
mode:
authorGravatar Arnaldo Carvalho de Melo <acme@redhat.com> 2023-04-12 14:56:28 -0300
committerGravatar Arnaldo Carvalho de Melo <acme@redhat.com> 2023-04-12 15:52:47 -0300
commit9efe423e4387893498e11c75207bc9a1c9121246 (patch)
tree4c27e3d269c834eb9d3d108e2fbefd4396725940 /tools/perf/util/pmu.c
parentlibperf: Add a perf_cpu_map__set_nr() available as an internal function for t... (diff)
downloadlinux-9efe423e4387893498e11c75207bc9a1c9121246.tar.gz
linux-9efe423e4387893498e11c75207bc9a1c9121246.tar.bz2
linux-9efe423e4387893498e11c75207bc9a1c9121246.zip
perf pmu: Use perf_cpu_map__set_nr() in perf_pmu__cpus_match() to allow for refcnt checking
One more step to allow for checking reference counting, user after free, etc. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Riccardo Mancini <rickyman7@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Stephen Brennan <stephen.s.brennan@oracle.com> Link: https://lore.kernel.org/ZDb9dycHQ11UIXwx@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/pmu.c')
-rw-r--r--tools/perf/util/pmu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 561e2616861f..760c848c9fa2 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -2020,8 +2020,8 @@ int perf_pmu__cpus_match(struct perf_pmu *pmu, struct perf_cpu_map *cpus,
matched_cpus->map[matched_nr++] = cpu;
}
- unmatched_cpus->nr = unmatched_nr;
- matched_cpus->nr = matched_nr;
+ perf_cpu_map__set_nr(unmatched_cpus, unmatched_nr);
+ perf_cpu_map__set_nr(matched_cpus, matched_nr);
*mcpus_ptr = matched_cpus;
*ucpus_ptr = unmatched_cpus;
return 0;