Round up bootwrapper alloc size for vmlinux to page size
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 <[email protected]>
---
main.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
---
arch/powerpc/boot/main.c +1 -1
@@ -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 ();