[PATCH] MIPS: fix mapstart when using initrd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ashoks@xxxxxxxxxxxx>
---
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




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux