All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: fix mapstart when using initrd
@ 2013-09-23 14:10 Ashok Kumar
  2013-10-07 16:08 ` Ralf Baechle
  2013-10-14 12:05 ` Jonas Gorski
  0 siblings, 2 replies; 8+ messages in thread
From: Ashok Kumar @ 2013-09-23 14:10 UTC (permalink / raw)
  To: linux-mips, gerg; +Cc: ralf, Ashok Kumar

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@broadcom.com>
---
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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-10-15 10:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-23 14:10 [PATCH] MIPS: fix mapstart when using initrd Ashok Kumar
2013-10-07 16:08 ` Ralf Baechle
2013-10-07 16:10   ` Markos Chandras
2013-10-07 16:10     ` Markos Chandras
2013-10-07 16:29     ` Ralf Baechle
2013-10-14 12:05 ` Jonas Gorski
2013-10-15 10:19   ` Ashok Kumar
     [not found]   ` <525d1725.85680e0a.0dea.4371SMTPIN_ADDED_BROKEN@mx.google.com>
2013-10-15 10:57     ` Jonas Gorski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.