From c74e3295ae4a5338f91e971aee1638fa08a9b97d Mon Sep 17 00:00:00 2001 From: Hannes Schmelzer Date: Thu, 11 Oct 2018 07:44:42 +0200 Subject: [PATCH] x86/bootm: fix error handling in boot_prep_linux(...) Once we get a zero pointer from load_zimage(...) we must bunch out instead of continue boot. Signed-off-by: Hannes Schmelzer Reviewed-by: Bin Meng --- arch/x86/lib/bootm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 54c22fe..832b1f9 100644 --- a/arch/x86/lib/bootm.c +++ b/arch/x86/lib/bootm.c @@ -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;