aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-12-03 14:29:53 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-12-20 10:08:27 -0500
commit8975b6c0fdd57e061f4d1040163778ceaf340ad8 (patch)
tree23e2b750f79b69c6610ecb8061b3aa2d027f9dc8 /arch
parentbbc3d14e9aca023bb98e580aa1c9350af8effdb1 (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')
-rw-r--r--arch/arm/mach-omap2/omap-smp.c6
-rw-r--r--arch/arm/mach-realview/platsmp.c7
-rw-r--r--arch/arm/mach-s5pv310/platsmp.c7
-rw-r--r--arch/arm/mach-tegra/platsmp.c6
-rw-r--r--arch/arm/mach-ux500/platsmp.c6
-rw-r--r--arch/arm/mach-vexpress/platsmp.c7
6 files changed, 6 insertions, 33 deletions
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 3c87468ce9cb..5f10f38354ae 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -121,12 +121,6 @@ void __init smp_init_cpus(void)
121 ncores = get_core_count(); 121 ncores = get_core_count();
122 122
123 /* sanity check */ 123 /* sanity check */
124 if (ncores == 0) {
125 printk(KERN_ERR
126 "OMAP4: strange core count of 0? Default to 1\n");
127 ncores = 1;
128 }
129
130 if (ncores > NR_CPUS) { 124 if (ncores > NR_CPUS) {
131 printk(KERN_WARNING 125 printk(KERN_WARNING
132 "OMAP4: no. of cores (%d) greater than configured " 126 "OMAP4: no. of cores (%d) greater than configured "
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 108e92f9746b..13116cd37639 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -161,13 +161,6 @@ void __init smp_init_cpus(void)
161 unsigned int i, ncores = get_core_count(); 161 unsigned int i, ncores = get_core_count();
162 162
163 /* sanity check */ 163 /* sanity check */
164 if (ncores == 0) {
165 printk(KERN_ERR
166 "Realview: strange CM count of 0? Default to 1\n");
167
168 ncores = 1;
169 }
170
171 if (ncores > NR_CPUS) { 164 if (ncores > NR_CPUS) {
172 printk(KERN_WARNING 165 printk(KERN_WARNING
173 "Realview: no. of cores (%d) greater than configured " 166 "Realview: no. of cores (%d) greater than configured "
diff --git a/arch/arm/mach-s5pv310/platsmp.c b/arch/arm/mach-s5pv310/platsmp.c
index d474426f37b7..560ada83b0b1 100644
--- a/arch/arm/mach-s5pv310/platsmp.c
+++ b/arch/arm/mach-s5pv310/platsmp.c
@@ -130,13 +130,6 @@ void __init smp_init_cpus(void)
130 ncores = scu_base ? scu_get_core_count(scu_base) : 1; 130 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
131 131
132 /* sanity check */ 132 /* sanity check */
133 if (ncores == 0) {
134 printk(KERN_ERR
135 "S5PV310: strange CM count of 0? Default to 1\n");
136
137 ncores = 1;
138 }
139
140 if (ncores > NR_CPUS) { 133 if (ncores > NR_CPUS) {
141 printk(KERN_WARNING 134 printk(KERN_WARNING
142 "S5PV310: no. of cores (%d) greater than configured " 135 "S5PV310: no. of cores (%d) greater than configured "
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}
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index a51962b7579b..e31024e3a7cc 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -129,12 +129,6 @@ void __init smp_init_cpus(void)
129 unsigned int i, ncores = get_core_count(); 129 unsigned int i, ncores = get_core_count();
130 130
131 /* sanity check */ 131 /* sanity check */
132 if (ncores == 0) {
133 printk(KERN_ERR
134 "U8500: strange CM count of 0? Default to 1\n");
135 ncores = 1;
136 }
137
138 if (ncores > NR_CPUS) { 132 if (ncores > NR_CPUS) {
139 printk(KERN_WARNING 133 printk(KERN_WARNING
140 "U8500: no. of cores (%d) greater than configured " 134 "U8500: no. of cores (%d) greater than configured "
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 276f916014c1..b5a758683668 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -124,13 +124,6 @@ void __init smp_init_cpus(void)
124 ncores = scu_base ? scu_get_core_count(scu_base) : 1; 124 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
125 125
126 /* sanity check */ 126 /* sanity check */
127 if (ncores == 0) {
128 printk(KERN_ERR
129 "vexpress: strange CM count of 0? Default to 1\n");
130
131 ncores = 1;
132 }
133
134 if (ncores > NR_CPUS) { 127 if (ncores > NR_CPUS) {
135 printk(KERN_WARNING 128 printk(KERN_WARNING
136 "vexpress: no. of cores (%d) greater than configured " 129 "vexpress: no. of cores (%d) greater than configured "