]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ppc64: fix off-by-one in mem_init()
authorDave Hansen <haveblue@us.ibm.com>
Mon, 2 Aug 2004 03:09:59 +0000 (20:09 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 2 Aug 2004 03:09:59 +0000 (20:09 -0700)
lmb_end_of_DRAM() returns the address of the end of RAM, not the starting
address of the last page.  We've been accessing mem_map[] out of bounds for
quite a while.  But, it's just a read, so it's probably never caused a real
problem.

But, during my port of CONFIG_NONLINEAR to ppc64, I have a check to make
sure that all __va() calls are given with valid physical addresses.  This
code tripped that check.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ppc64/mm/init.c

index 9c4829600c45032439bd063100100c0833de0dc3..99d923868a6e67775e4b49ef2f2647ca7e93c782 100644 (file)
@@ -655,7 +655,7 @@ void __init mem_init(void)
 
        totalram_pages += free_all_bootmem();
 
-       for (addr = KERNELBASE; addr <= (unsigned long)__va(lmb_end_of_DRAM());
+       for (addr = KERNELBASE; addr < (unsigned long)__va(lmb_end_of_DRAM());
             addr += PAGE_SIZE) {
                if (!PageReserved(virt_to_page(addr)))
                        continue;