Patchwork Selfboot error checking fix

login
register
about
Submitter Myles Watson
Date 2010-05-04 22:28:25
Message ID <p2g2831fecf1005041528kea52cacdp74b217223291f613@mail.gmail.com>
Download mbox | patch
Permalink /patch/1286/
State Accepted
Commit r5602
Headers show

Comments

Myles Watson - 2010-05-04 22:28:25
Check the return value of ulzma, and quit instead of loading the next
segment if there's an error.

Size pointers 8 characters instead of 16 to beautify the common case
where selfboot is loading something into memory below 4GB.

Signed-off-by: Myles Watson <mylesgw@gmail.com>

Thanks,
Myles
Stefan Reinauer - 2010-05-30 11:23:33
On 5/5/10 12:28 AM, Myles Watson wrote:
> Check the return value of ulzma, and quit instead of loading the next
> segment if there's an error.
>
> Size pointers 8 characters instead of 16 to beautify the common case
> where selfboot is loading something into memory below 4GB.
>
> Signed-off-by: Myles Watson <mylesgw@gmail.com>
>
> Thanks,
> Myles
>   
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Myles Watson - 2010-06-01 15:21:45
> Check the return value of ulzma, and quit instead of loading the next
> segment if there's an error.
>
> Size pointers 8 characters instead of 16 to beautify the common case
> where selfboot is loading something into memory below 4GB.
>
> Signed-off-by: Myles Watson <mylesgw@gmail.com>

> Acked-by: Stefan Reinauer <stepan@coresystems.de>

Rev 5602.

Thanks,
Myles

Patch

Index: src/boot/selfboot.c
===================================================================
--- src/boot/selfboot.c	(revision 5521)
+++ src/boot/selfboot.c	(working copy)
@@ -473,6 +473,8 @@ 
 				case CBFS_COMPRESS_LZMA: {
 					printk(BIOS_DEBUG, "using LZMA\n");
 					len = ulzma(src, dest);
+					if (!len) /* Decompression Error. */
+						return 0;
 					break;
 				}
 #if CONFIG_COMPRESSED_PAYLOAD_NRV2B==1
@@ -495,7 +497,7 @@ 
 			}
 			end = dest + ptr->s_memsz;
 			middle = dest + len;
-			printk(BIOS_SPEW, "[ 0x%016lx, %016lx, 0x%016lx) <- %016lx\n",
+			printk(BIOS_SPEW, "[ 0x%08lx, %08lx, 0x%08lx) <- %08lx\n",
 				(unsigned long)dest,
 				(unsigned long)middle,
 				(unsigned long)end,