[POWERPC] ppc405 Fix arithmatic rollover bug when memory size under 16M
authorGrant Likely <grant.likely@secretlab.ca>
Wed, 31 Oct 2007 06:41:20 +0000 (17:41 +1100)
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>
Thu, 1 Nov 2007 12:15:59 +0000 (07:15 -0500)
commitbd942ba3db60d3bd4e21febbe7c5e339d973d5a8
treeff306770ca15454fb73c040a7fd47a027c7f89f2
parentb98ac05d5e460301fbea24cceed0f2a601c82e22
[POWERPC] ppc405 Fix arithmatic rollover bug when memory size under 16M

mmu_mapin_ram() loops over total_lowmem to setup page tables.  However, if
total_lowmem is less that 16M, the subtraction rolls over and results in
a number just under 4G (because total_lowmem is an unsigned value).

This patch rejigs the loop from countup to countdown to eliminate the
bug.

Special thanks to Magnus Hjorth who wrote the original patch to fix this
bug.  This patch improves on his by making the loop code simpler (which
also eliminates the possibility of another rollover at the high end)
and also applies the change to arch/powerpc.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
arch/powerpc/mm/40x_mmu.c
arch/ppc/mm/4xx_mmu.c