LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Mark A. Greer" <mgreer@mvista.com>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev <Linuxppc-dev@ozlabs.org>
Subject: [POWERPC] Round up bootwrapper alloc size for vmlinux to page size
Date: Wed, 25 Oct 2006 16:36:16 -0700	[thread overview]
Message-ID: <20061025233616.GA17461@mag.az.mvista.com> (raw)

The powerpc kernel linker script, arch/powerpc/kernel/vmlinux.lds.S,
aligns '_end' up to a page boundary.  However, the bootwrapper
does not round up the size of the area that it allocates to gunzip
the kernel into.  This leaves space between '__bss_stop' and '_end'
where the bootwrapper could allocate other things (e.g., space for
a flattened device tree).  This patch rounds up the allocation size
to a multiple of the page size to match '_end' and prevent the latent
bug.

Signed-off-by: Mark A. Greer <mgreer@mvista.com>
---

 main.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
---

diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 4184974..234bb5b 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -198,7 +198,7 @@ static void prep_kernel(unsigned long *a
 	 * be claimed (it will be zero'd by the kernel itself)
 	 */
 	printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux.memsize);
-	vmlinux.addr = (unsigned long)malloc(vmlinux.memsize);
+	vmlinux.addr = (unsigned long)malloc(_ALIGN(vmlinux.memsize, 4096));
 	if (vmlinux.addr == 0) {
 		printf("Can't allocate memory for kernel image !\n\r");
 		exit();

                 reply	other threads:[~2006-10-25 23:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061025233616.GA17461@mag.az.mvista.com \
    --to=mgreer@mvista.com \
    --cc=Linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox