From: Tony Luck Date: Fri, 7 Jan 2011 17:11:55 +0000 (-0800) Subject: [IA64] Avoid array overflow if there are too many cpus in SRAT table X-Git-Tag: firefly_0821_release~7613^2~3072^2^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=05f2f274c8a8747bbfb13ac8ee0c27d5f2ad8510;p=firefly-linux-kernel-4.4.55.git [IA64] Avoid array overflow if there are too many cpus in SRAT table acpi_numa_init() has to parse the whole SRAT table, even if the kernel wants to limit the number of cpus it will use (because the ones it is going to use may be described by entries at the end of the SRAT table). Avoid overflowing the node_cpuid array. Reported-by: Yinghai Lu Signed-off-by: Tony Luck --- diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index c6c90f39f4d9..7b897b7b0ae6 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -477,6 +477,12 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) if (!(pa->flags & ACPI_SRAT_CPU_ENABLED)) return; + if (srat_num_cpus >= ARRAY_SIZE(node_cpuid)) { + printk_once(KERN_WARNING + "node_cpuid[%d] is too small, may not be able to use all cpus\n", + ARRAY_SIZE(node_cpuid)); + return; + } pxm = get_processor_proximity_domain(pa); /* record this node in proximity bitmap */