x86: boot: fix unreachable else branch in boot_prep_linux
PATCH 1/1 x86: boot: fix unreachable else branch in boot_prep_linux
The else if branch uses the is_zimage boolean which is initialized to 0 and never set before being tested here.
remove the test on is_zimage to make this code reachable.
--- arch/x86/lib/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/bootm.c +1 -1
@@ -103,7 +103,7 @@ static int boot_prep_linux(struct bootm_headers *images) } is_zimage =1 ;#if defined(CONFIG_FIT ) - } else if (images->fit_uname_os && is_zimage) { + } else if (images->fit_uname_os) { ret =fit_image_get_data (images->fit_hdr_os, images->fit_noffset_os, (const void **)&data, &len);
---
base-commit: c85b8071e7d3fd333f8a2fdd28083cb5ec3a0645
change-id: 20250703-fix_fit_zimage-57bd629f5ab5
Best regards,
Signature · 1 line
Guillaume Ranquet <[email protected]>
Quoted 29 lines · Guillaume Ranquet
The else if branch uses the
is_zimageboolean which is initialized to 0 and never set before being tested here.remove the test on
is_zimageto make this code reachable.Signed-off-by Guillaume Ranquet <[email protected]>--- arch/x86/lib/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/lib/bootm.c +1
-2@@ -103,7 +103,7 @@ static int boot_prep_linux(struct bootm_headers *images) } is_zimage =1 ;#if defined(CONFIG_FIT ) - } else if (images->fit_uname_os && is_zimage) { + } else if (images->fit_uname_os) { ret =fit_image_get_data (images->fit_hdr_os, images->fit_noffset_os, (const void **)&data, &len); ---base-commit:
c85b8071e7d3fd333f8a2fdd28083cb5ec3a0645
change-id: 20250703-fix_fit_zimage-57bd629f5ab5
Quoted 4 lines
Best regards,
--
Guillaume Ranquet <[email protected]>
Hello.
Seems this has gone a bit unnoticed. So let me try to add a bit of context on why I ended up sending this fix.
I'm running Xen on x86 using fitImage with hyperlaunch (I can give details on what is hyperlaunch and how I'm using it, but this [1] should help already).
So my fitImage has 2 configurations:
* Xen with Linux as a loadable
* Linux as a baremetal image (used for recovery/provisioning)
Why am I using a bzImage as a linux loadable for Xen? Because this is the easiest thing to start with Xen (it might be possible to load a gzipped elf without the setup bit of the bzImage) but I haven't spent time looking into it and a bzImage is what my OEM is working with.
So, in order to keep things simple, I want to also boot linux as a bzImage from a fit image in my recovery configuration.
Hope this bit of context helps with the review.
Thx,
Guillaume.
[1]: https://docs.u-boot.org/en/latest/usage/fit/multi-with-loadables.html
Quoted 11 lines · Guillaume Ranquet
The else if branch uses the
is_zimageboolean which is initialized to 0 and never set before being tested here.remove the test on
is_zimageto make this code reachable.Signed-off-by Guillaume Ranquet <[email protected]>--- arch/x86/lib/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 6 lines · Guillaume Ranquet
The else if branch uses the
is_zimageboolean which is initialized to 0 and never set before being tested here.remove the test on
is_zimageto make this code reachable.
Applied to u-boot/master, thanks!
[1/1] x86: boot: fix unreachable else branch in boot_prep_linux
commit: 0cb8a88e7ab7824b7dc857fb6572705f3e19c456
Signature · 1 line
Tom