summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2015-09-17 12:45:11 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-09-21 08:11:35 +0200
commit29986f9ff4f9001a500550e9bde9d15c57de21d3 (patch)
tree724d9bff2d16fa0e888a412e41c5ec9591b355f2 /arch/arm/cpu
parent485ef5279e3ebbf5f9bbc5bc36a1444c6c5db25f (diff)
downloadbarebox-29986f9ff4f9001a500550e9bde9d15c57de21d3.tar.gz
barebox-29986f9ff4f9001a500550e9bde9d15c57de21d3.tar.xz
ARM: MMU: fixed calculation of number of PTEs
barebox uses 4KiB pages so that number of PTEs is 'size >> 12', not 'size >> 10'. Thie 'size >> 10' limit is not an immediate problem because it allocates too much PTEs only which are not used. But it can overflow an integer multiplication ('i * PAGE_SIZE') which causes undefined behaviour with gcc5. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu')
-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 3a4a17c7dd..470b448957 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -215,7 +215,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 >> 20) + (bank->size >> 20);
- unsigned long num_ptes = bank->size >> 10;
+ unsigned long num_ptes = bank->size >> 12;
int i, pte;
u32 *ptes;