Skip to content

Commit

Permalink
ARM: SMP: Clean up ncores sanity checks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Russell King committed Dec 20, 2010
1 parent bbc3d14 commit 8975b6c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 33 deletions.
6 changes: 0 additions & 6 deletions arch/arm/mach-omap2/omap-smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ void __init smp_init_cpus(void)
ncores = get_core_count();

/* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"OMAP4: strange core count of 0? Default to 1\n");
ncores = 1;
}

if (ncores > NR_CPUS) {
printk(KERN_WARNING
"OMAP4: no. of cores (%d) greater than configured "
Expand Down
7 changes: 0 additions & 7 deletions arch/arm/mach-realview/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,6 @@ void __init smp_init_cpus(void)
unsigned int i, ncores = get_core_count();

/* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"Realview: strange CM count of 0? Default to 1\n");

ncores = 1;
}

if (ncores > NR_CPUS) {
printk(KERN_WARNING
"Realview: no. of cores (%d) greater than configured "
Expand Down
7 changes: 0 additions & 7 deletions arch/arm/mach-s5pv310/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1;

/* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"S5PV310: strange CM count of 0? Default to 1\n");

ncores = 1;
}

if (ncores > NR_CPUS) {
printk(KERN_WARNING
"S5PV310: no. of cores (%d) greater than configured "
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/mach-tegra/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ void __init smp_init_cpus(void)
{
unsigned int i, ncores = scu_get_core_count(scu_base);

if (ncores > NR_CPUS) {
printk(KERN_ERR "Tegra: no. of cores (%u) greater than configured (%u), clipping\n",
ncores, NR_CPUS);
ncores = NR_CPUS;
}

for (i = 0; i < ncores; i++)
cpu_set(i, cpu_possible_map);
}
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-ux500/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ void __init smp_init_cpus(void)
unsigned int i, ncores = get_core_count();

/* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"U8500: strange CM count of 0? Default to 1\n");
ncores = 1;
}

if (ncores > NR_CPUS) {
printk(KERN_WARNING
"U8500: no. of cores (%d) greater than configured "
Expand Down
7 changes: 0 additions & 7 deletions arch/arm/mach-vexpress/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,6 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1;

/* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"vexpress: strange CM count of 0? Default to 1\n");

ncores = 1;
}

if (ncores > NR_CPUS) {
printk(KERN_WARNING
"vexpress: no. of cores (%d) greater than configured "
Expand Down

0 comments on commit 8975b6c

Please sign in to comment.