diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-03 14:29:53 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-20 10:08:27 -0500 |
commit | 8975b6c0fdd57e061f4d1040163778ceaf340ad8 (patch) | |
tree | 23e2b750f79b69c6610ecb8061b3aa2d027f9dc8 /arch/arm/mach-tegra/platsmp.c | |
parent | bbc3d14e9aca023bb98e580aa1c9350af8effdb1 (diff) |
ARM: SMP: Clean up ncores sanity checks
scu_get_core_count() never returns zero cores, so we don't need to
check and correct if ncores is zero.
Tegra was missing the check against NR_CPUS, leading to a potential
bitfield overflow if this becomes the case.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-tegra/platsmp.c')
-rw-r--r-- | arch/arm/mach-tegra/platsmp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c index 1c0fd92cab39..5b194dd815a8 100644 --- a/arch/arm/mach-tegra/platsmp.c +++ b/arch/arm/mach-tegra/platsmp.c | |||
@@ -117,6 +117,12 @@ void __init smp_init_cpus(void) | |||
117 | { | 117 | { |
118 | unsigned int i, ncores = scu_get_core_count(scu_base); | 118 | unsigned int i, ncores = scu_get_core_count(scu_base); |
119 | 119 | ||
120 | if (ncores > NR_CPUS) { | ||
121 | printk(KERN_ERR "Tegra: no. of cores (%u) greater than configured (%u), clipping\n", | ||
122 | ncores, NR_CPUS); | ||
123 | ncores = NR_CPUS; | ||
124 | } | ||
125 | |||
120 | for (i = 0; i < ncores; i++) | 126 | for (i = 0; i < ncores; i++) |
121 | cpu_set(i, cpu_possible_map); | 127 | cpu_set(i, cpu_possible_map); |
122 | } | 128 | } |