LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [POWERPC] Round up bootwrapper alloc size for vmlinux to page size
@ 2006-10-25 23:36 Mark A. Greer
  0 siblings, 0 replies; only message in thread
From: Mark A. Greer @ 2006-10-25 23:36 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

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();

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-25 23:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-25 23:36 [POWERPC] Round up bootwrapper alloc size for vmlinux to page size Mark A. Greer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox