From 5a6410edd7fcbd16c7c637a22a8bab7dcaeda402 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 18 Mar 2014 09:53:18 +0100 Subject: 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 Tested-by: Sean Cross --- arch/arm/cpu/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3