Skip to content

Commit

Permalink
powerpc/mpic: Limit NR_CPUS loop to 32 bit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Milton Miller authored and Benjamin Herrenschmidt committed May 19, 2011
1 parent aa79bc2 commit ebc0421
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/mpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ebc0421

Please sign in to comment.