Thread (6 messages) 6 messages, 4 authors, 2013-10-15

[PATCH] MIPS: fix mapstart when using initrd

From: Ashok Kumar <hidden>
Date: 2013-09-23 14:11:26
Subsystem: mips, the rest · Maintainers: Thomas Bogendoerfer, Linus Torvalds

When initrd is present in the PFN right after the _end, bootmem
bitmap(mapstart) overwrites it. So check for initrd_end in
mapstart calculation.

Signed-off-by: Ashok Kumar <redacted>
---
This is seen after the commit
"mips: fix start of free memory when using initrd"
in git://git.linux-mips.org/pub/scm/ralf/upstream-sfr.git branch

Tested the image on MIPS platform creating the above
said scenario and initrd was corrupted.

 arch/mips/kernel/setup.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 5342385..dfb8585 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -364,6 +364,11 @@ static void __init bootmem_init(void)
 	}
 
 	/*
+	 * mapstart should be after initrd_end
+	 */
+	mapstart = max(mapstart, (unsigned long)PFN_UP(__pa(initrd_end)));
+
+	/*
 	 * Initialize the boot-time allocator with low memory only.
 	 */
 	bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart,
-- 
1.7.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help