[PATCH 4/4] bootwrapper: decompress less, check more

Milton Miller miltonm at bga.com
Thu Mar 29 23:31:41 EST 2007


Our kernels put everything in the first load segment, and we read that.
Instead of decompresing to the end of the gzip stream or supplied image
and hoping we get it all, decompress the expected size and complain if
it is not available.

Signed-off-by: Milton Miller <miltonm at bga.com>
--- 
Changed the gunzipping message back to the original to stay within 80
characters per printed line.

Index: kernel/arch/powerpc/boot/main.c
===================================================================
--- kernel.orig/arch/powerpc/boot/main.c	2007-03-29 06:12:16.000000000 -0500
+++ kernel/arch/powerpc/boot/main.c	2007-03-29 08:24:14.000000000 -0500
@@ -145,7 +145,10 @@ static struct addr_range prep_kernel(voi
 	       vmlinuz_addr, vmlinuz_addr+vmlinuz_size);
 	/* discard up to the actual load data */
 	gunzip_discard(&gzstate, ei.elfoffset - sizeof(elfheader));
-	len = gunzip_finish(&gzstate, addr, ei.memsize);
+	len = gunzip_finish(&gzstate, addr, ei.loadsize);
+	if (len != ei.loadsize)
+		fatal("ran out of data!  only got 0x%x of 0x%lx bytes.\n\r",
+				len, ei.loadsize);
 	printf("done 0x%x bytes\n\r", len);
 
 	flush_cache(addr, ei.loadsize);



More information about the Linuxppc-dev mailing list