mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
perf header: Validate nr_domains when reading HEADER_CPU_DOMAIN_INFO
Further validate the HEADER_CPU_DOMAIN_INFO fields, this time checking the nr_domains field. Assisted-by: Claude Code:claude-opus-4-6 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
fab205e492
commit
f823d7efb8
|
|
@ -3731,6 +3731,12 @@ static int process_cpu_domain_info(struct feat_fd *ff, void *data __maybe_unused
|
|||
if (do_read_u32(ff, &nr_domains))
|
||||
return -1;
|
||||
|
||||
if (nr_domains > max_sched_domains) {
|
||||
pr_err("Invalid HEADER_CPU_DOMAIN_INFO: nr_domains %u > max_sched_domains (%u)\n",
|
||||
nr_domains, max_sched_domains);
|
||||
return -1;
|
||||
}
|
||||
|
||||
cd_map[cpu]->nr_domains = nr_domains;
|
||||
|
||||
cd_map[cpu]->domains = calloc(max_sched_domains, sizeof(*d_info));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user