[PATCH] ppc4xx: mmu_mapin_ram bugfix for booting with mem<16 MB

Magnus Hjorth mh at omnisys.se
Sat Oct 27 18:35:16 EST 2007


From: Magnus Hjorth <mh at omnisys.se>

This patch (for 2.6.23.1) fixes an unsigned arithmetic bug causing the
kernel to hang when booting with less than 16 MB of memory on ppc4xx.

Signed-off-by: Magnus Hjorth <mh at omnisys.se>

---

OK, trying to do this by the book now...

--- linux-2.6.23.1/arch/ppc/mm/4xx_mmu.c.orig	2007-10-27 10:14:42.000000000 +0200
+++ linux-2.6.23.1/arch/ppc/mm/4xx_mmu.c	2007-10-27 10:15:34.000000000 +0200
@@ -105,7 +105,7 @@ unsigned long __init mmu_mapin_ram(void)
 		return s;
 	}
 
-	while (s <= (total_lowmem - LARGE_PAGE_SIZE_16M)) {
+	while (s + LARGE_PAGE_SIZE_16M <= total_lowmem) {
 		pmd_t *pmdp;
 		unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE;
 
@@ -120,7 +120,7 @@ unsigned long __init mmu_mapin_ram(void)
 		s += LARGE_PAGE_SIZE_16M;
 	}
 
-	while (s <= (total_lowmem - LARGE_PAGE_SIZE_4M)) {
+	while (s + LARGE_PAGE_SIZE_4M <= total_lowmem) {
 		pmd_t *pmdp;
 		unsigned long val = p | _PMD_SIZE_4M | _PAGE_HWEXEC | _PAGE_HWWRITE;
 




More information about the Linuxppc-embedded mailing list