Skip to content

Commit

Permalink
[IA64] Avoid array overflow if there are too many cpus in SRAT table
Browse files Browse the repository at this point in the history
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 <yinghai@kernel.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
  • Loading branch information
Tony Luck committed Jan 7, 2011
1 parent e7d2825 commit 05f2f27
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/ia64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 05f2f27

Please sign in to comment.