aboutsummaryrefslogtreecommitdiff
path: root/tools/lib/perf/include
diff options
context:
space:
mode:
authorGravatar Arnaldo Carvalho de Melo <acme@redhat.com> 2023-04-17 12:47:49 -0300
committerGravatar Arnaldo Carvalho de Melo <acme@redhat.com> 2023-04-17 15:52:36 -0300
commit4121234a32887a49d5da06e4c219f67abb6e744f (patch)
tree00263dcb3b1133eb95b5927cf6cefddcde069b03 /tools/lib/perf/include
parentperf test: Simplify for_each_test() to avoid tripping on -Werror=array-bounds (diff)
downloadlinux-4121234a32887a49d5da06e4c219f67abb6e744f.tar.gz
linux-4121234a32887a49d5da06e4c219f67abb6e744f.tar.bz2
linux-4121234a32887a49d5da06e4c219f67abb6e744f.zip
libperf: Add perf_cpu_map__refcnt() interanl accessor to use in the maps test
To remove one more direct access to 'struct perf_cpu_map' so that we can intercept accesses to its instantiations and refcount check it to catch use 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/lkml/ZD1qdYjG+DL6KOfP@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/perf/include')
-rw-r--r--tools/lib/perf/include/internal/cpumap.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/lib/perf/include/internal/cpumap.h b/tools/lib/perf/include/internal/cpumap.h
index b82fd6607a00..1e840dd53a11 100644
--- a/tools/lib/perf/include/internal/cpumap.h
+++ b/tools/lib/perf/include/internal/cpumap.h
@@ -30,4 +30,8 @@ bool perf_cpu_map__is_subset(const struct perf_cpu_map *a, const struct perf_cpu
void perf_cpu_map__set_nr(struct perf_cpu_map *map, int nr_cpus);
+static inline refcount_t *perf_cpu_map__refcnt(struct perf_cpu_map *map)
+{
+ return &map->refcnt;
+}
#endif /* __LIBPERF_INTERNAL_CPUMAP_H */