summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-03-18 09:53:18 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-03-18 17:26:23 +0100
commit5a6410edd7fcbd16c7c637a22a8bab7dcaeda402 (patch)
tree9a264a8996cfd2039424e0a7deb024afd4916078
parent0017d4d2d68736f92d9efcecccf73e9475591578 (diff)
downloadbarebox-5a6410edd7fcbd16c7c637a22a8bab7dcaeda402.tar.gz
barebox-5a6410edd7fcbd16c7c637a22a8bab7dcaeda402.tar.xz
ARM: MMU: Fix memory reaching to the end of address space
For memory reaching the end of the address space phys + bank->size overflows to 0. Fix this by right shifting phys and bank->size before adding them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Sean Cross <xobs@kosagi.com>
-rw-r--r--arch/arm/cpu/mmu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index 84daa3d80e..bf0141b946 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -200,7 +200,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank)
{
unsigned long phys = (unsigned long)bank->start;
unsigned long ttb_start = phys >> 20;
- unsigned long ttb_end = (phys + bank->size) >> 20;
+ unsigned long ttb_end = (phys >> 20) + (bank->size >> 20);
unsigned long num_ptes = bank->size >> 10;
int i, pte;
u32 *ptes;