]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] bootwrapper: Decompress less, check more
authorMilton Miller <miltonm@bga.com>
Thu, 29 Mar 2007 13:31:41 +0000 (07:31 -0600)
committerPaul Mackerras <paulus@samba.org>
Thu, 12 Apr 2007 17:55:17 +0000 (03:55 +1000)
Our kernels put everything in the first load segment, and we read that.
Instead of decompressing 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@bga.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/boot/main.c

index 30390621203dde336f7ca2c024a68884cffaf629..56b56a8d4b2334081dbc63452697da21cd5c8078 100644 (file)
@@ -79,7 +79,10 @@ static struct addr_range prep_kernel(void)
               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);