linux-mips
[Top] [All Lists]

[PATCH] MIPS: fix mapstart when using initrd

To: linux-mips@linux-mips.org, gerg@uclinux.org
Subject: [PATCH] MIPS: fix mapstart when using initrd
From: "Ashok Kumar" <ashoks@broadcom.com>
Date: Mon, 23 Sep 2013 19:40:26 +0530
Cc: ralf@linux-mips.org, "Ashok Kumar" <ashoks@broadcom.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
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



<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] MIPS: fix mapstart when using initrd, Ashok Kumar <=