summaryrefslogtreecommitdiff
path: root/tools/perf/tests/hists_link.c
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2023-04-19 12:57:53 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-04-19 12:57:53 -0300
commit2832ef81d4c75d4f0e3945bd2cb0b7012313cbb3 (patch)
treef52c0d327cc431927e5df4880295060ab462466f /tools/perf/tests/hists_link.c
parente6a9efcee55f084a5450e4853ecbbaa0b086dcd0 (diff)
downloadlwn-2832ef81d4c75d4f0e3945bd2cb0b7012313cbb3.tar.gz
lwn-2832ef81d4c75d4f0e3945bd2cb0b7012313cbb3.zip
perf map: Add reference count checking
There's no strict get/put policy with map that leads to leaks or use after free. Reference count checking identifies correct pairing of gets and puts. Committer notes: Extracted from a larger patch removing bits that were covered by the use of pre-existing map__ accessors (e.g. maps__nr_maps()) and new ones added (map__refcnt() and the maps__set_ ones) to reduce RC_CHK_ACCESS(maps)-> source code pollution. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: Dmitriy Vyukov <dvyukov@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/20230407230405.2931830-6-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/hists_link.c')
-rw-r--r--tools/perf/tests/hists_link.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 64ce8097889c..141e2972e34f 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -145,7 +145,7 @@ static int find_sample(struct sample *samples, size_t nr_samples,
{
while (nr_samples--) {
if (samples->thread == t &&
- samples->map == m &&
+ RC_CHK_ACCESS(samples->map) == RC_CHK_ACCESS(m) &&
samples->sym == s)
return 1;
samples++;