powerpc/mpic: Limit NR_CPUS loop to 32 bit
authorMilton Miller <miltonm@bga.com>
Tue, 10 May 2011 19:28:59 +0000 (19:28 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 19 May 2011 04:30:45 +0000 (14:30 +1000)
mpic_physmask was looping NR_CPUS times over a mask that was passed as
a u32. Since mpic is architecturaly limited to 32 physical cpus, clamp
the logical cpus to 32 when compiling (we could also clamp at runtime
to nr_cpu_ids).

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/sysdev/mpic.c

index 824a94fc413be59709791dbbbb8739d442b4f7f3..a93da805435ff2dbf41fee1c545da329b75490bb 100644 (file)
@@ -631,7 +631,7 @@ static inline u32 mpic_physmask(u32 cpumask)
        int i;
        u32 mask = 0;
 
-       for (i = 0; i < NR_CPUS; ++i, cpumask >>= 1)
+       for (i = 0; i < min(32, NR_CPUS); ++i, cpumask >>= 1)
                mask |= (cpumask & 1) << get_hard_smp_processor_id(i);
        return mask;
 }
This page took 0.027545 seconds and 5 git commands to generate.