Skip to content

Commit 7b568e9

Browse files
ZideChen0Peter Zijlstra
authored andcommitted
perf/x86/intel/uncore: Skip discovery table for offline dies
This warning can be triggered if NUMA is disabled and the system boots with fewer CPUs than the number of CPUs in die 0. WARNING: CPU: 9 PID: 7257 at uncore.c:1157 uncore_pci_pmu_register+0x136/0x160 [intel_uncore] Currently, the discovery table continues to be parsed even if all CPUs in the associated die are offline. This can lead to an array overflow at "pmu->boxes[die] = box" in uncore_pci_pmu_register(), which may trigger the warning above or cause other issues. Fixes: edae1f0 ("perf/x86/intel/uncore: Parse uncore discovery tables") Reported-by: Steve Wahl <[email protected]> Signed-off-by: Zide Chen <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Dapeng Mi <[email protected]> Tested-by: Steve Wahl <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent e2a39d1 commit 7b568e9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/events/intel/uncore_discovery.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static bool uncore_discovery_pci(struct uncore_discovery_domain *domain)
371371
(val & UNCORE_DISCOVERY_DVSEC2_BIR_MASK) * UNCORE_DISCOVERY_BIR_STEP;
372372

373373
die = get_device_die_id(dev);
374-
if (die < 0)
374+
if ((die < 0) || (die >= uncore_max_dies()))
375375
continue;
376376

377377
parse_discovery_table(domain, dev, die, bar_offset, &parsed);

0 commit comments

Comments
 (0)