[Top] [All Lists]

[PATCH] MIPS: OCTEON: Don't clobber bootloader data structures.

Subject: [PATCH] MIPS: OCTEON: Don't clobber bootloader data structures.
From: David Daney <>
Date: Wed, 12 Jun 2013 11:28:33 -0700
Cc: David Daney <>, <>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=LLB6xyAynAI6jhZjiOPSgZyPcIc1bfok44u+VmNUfPU=; b=H+c8k9huxFKIYI4LEjItxLRQkhx7IXFrShPPzqxK+jpYV5yT1sjjoh4y8OQ/SW8gqW i4E7U9bMwUrhg187l3uCBJfTuy4x1+SNQ/Id8ulWVaT0epM+ThN6oeDb9CpEGEiD6kTN D9qSE+L8QBYyAiBpd79CxlzPYYalW/3yhYV2eE2vtCk+YRTUueOL/HZHSBZjB19C3vYS nWHTQ/SV0asx/mSnSuRps1ZHq4a2p+b//pwI4czCqpbU+TWsoD23IDOxnoGn/PiXjAZi Ev4nnbbRBqVrjU96wfYWBUacLnybDtB5gwpMBma6hV2tCYJmuZ3Bttnym8UeRvxMLX15 eREA==
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Original-recipient: rfc822;
From: David Daney <>

Commit abe77f90dc (MIPS: Octeon: Add kexec and kdump support) added a
bootmem region for the kernel image itself.  The problem is that this
is rounded up to a 0x100000 boundary, which is memory that may not be
owned by the kernel.  Depending on the kernel's configuration based
size, this 'extra' memory may contain data passed from the bootloader
to the kernel itself, which if clobbered makes the kernel crash in
various ways.

The fix: Quit rounding the size up, so that we only use memory
assigned to the kernel.

Can be applied to v3.8 and later.

Signed-off-by: David Daney <>
Cc: <>

This should probably go into 3.10

 arch/mips/cavium-octeon/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 01b1b3f..1e1e18c 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -996,7 +996,7 @@ void __init plat_mem_setup(void)
        /* Add the memory region for the kernel. */
        kernel_start = (unsigned long) _text;
-       kernel_size = ALIGN(_end - _text, 0x100000);
+       kernel_size = _end - _text;
        /* Adjust for physical offset. */
        kernel_start &= ~0xffffffff80000000ULL;

<Prev in Thread] Current Thread [Next in Thread>