Commit 148d8f9b authored by Dave Hansen's avatar Dave Hansen Committed by Linus Torvalds

[PATCH] ppc64: fix off-by-one in mem_init()

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: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 85786b02
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment