summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2026-06-04 18:14:23 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-06-04 19:17:36 -0300
commit1e7921d7227de5da0dfc167943092c823ec7e49b (patch)
treee2146ac625b1c6aee3434d0231d1a62179e444c0 /tools/perf/scripts/python
parent7ccd2e6cecd5bb02a5a15f0dd7199d1e81380bda (diff)
perf tools: Add bounds check to cpu__get_node()
cpu__get_node() accesses cpunode_map[cpu.cpu] without checking against max_cpu_num, the allocation size of cpunode_map. Callers such as builtin-kmem.c:evsel__process_alloc_event() pass sample->cpu from perf.data events, which may exceed the host's CPU count when analyzing cross-machine recordings. Add a bounds check against max_cpu_num before indexing, returning -1 for out-of-range values. This is a central fix that protects all callers. Fixes: 86895b480a2f ("perf stat: Add --per-node agregation support") Reported-by: sashiko-bot <sashiko-bot@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions