perf cpumap: Use perf_cpu_map__nr(cpus) to access cpus->nr
authorIan Rogers <irogers@google.com>
Wed, 12 Apr 2023 15:45:45 +0000 (12:45 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 12 Apr 2023 17:44:11 +0000 (14:44 -0300)
commit7bb1d048bdfe1c7d36fdd72be9abd5f552b6246a
tree6a9e2a9c9f6aab2d2a1ac89fd7ae7abb4f275903
parent4e8db2d7520f780f86055465c680e20327008a34
perf cpumap: Use perf_cpu_map__nr(cpus) to access cpus->nr

So that we can have a single point where to refcount check 'struct perf_cpu_map'
instances for use after free, etc.

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-3-irogers@google.com
[ Split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/cpumap.c