x86/bootm: fix error handling in boot_prep_linux(...)
authorHannes Schmelzer <hannes.schmelzer@br-automation.com>
Thu, 11 Oct 2018 05:44:42 +0000 (07:44 +0200)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 22 Oct 2018 09:51:45 +0000 (17:51 +0800)
Once we get a zero pointer from load_zimage(...) we must bunch out
instead of continue boot.

Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/lib/bootm.c

index 54c22fe6de3f50414446514d06bcda0412e5cfba..832b1f901c6486d3c515c2f239c49f6c423b0104 100644 (file)
@@ -116,6 +116,10 @@ static int boot_prep_linux(bootm_headers_t *images)
                char *base_ptr;
 
                base_ptr = (char *)load_zimage(data, len, &load_address);
+               if (!base_ptr) {
+                       puts("## Kernel loading failed ...\n");
+                       goto error;
+               }
                images->os.load = load_address;
                cmd_line_dest = base_ptr + COMMAND_LINE_OFFSET;
                images->ep = (ulong)base_ptr;