[PATCH 08/11] boot: fit: keep the load message for RAM-backed images

Simon Glass sjg at chromium.org
Thu Oct 1 09:02:40 PDT 2026


Hi Daniel,

On 2026-09-29T00:04:16, Daniel Golle <daniel at makrotopia.org> wrote:
> boot: fit: keep the load message for RAM-backed images
>
> The "Loading ... from ... to ..." line is suppressed whenever
> CONFIG_IMAGEMAP is built in and the source happens to equal the load
> address. The test is a build-time one, so a board that enables imagemap
> but boots a FIT from RAM loses the line as well.
>
> Suppress it only when an imagemap is actually in use, which is the one
> case where the data was read straight to its load address and there is
> no copy to report.
>
> Fixes: 46d32e38ee4e ("boot: fit: support on-demand loading in fit_image_load()")
> Signed-off-by: Daniel Golle <daniel at makrotopia.org>
>
> boot/image-fit.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

> diff --git a/boot/image-fit.c b/boot/image-fit.c
> @@ -2468,7 +2468,8 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
> -             if (!CONFIG_IS_ENABLED(IMAGEMAP) || data != load)
> +             /* A storage-backed image was read straight to its load address */
> +             if (!images->imagemap || data != load)

Dropping the CONFIG_IS_ENABLED(IMAGEMAP) term means images->imagemap
is read at runtime even when imagemap is not built, which isn't safe
for every caller. spl_load_fit_image() declares 'struct bootm_headers
images' on the stack and only sets 'verify', so in SPL (there is no
SPL_IMAGEMAP, so the old expression was always true) this now tests
uninitialised stack memory, and the message can disappear at random
when data == load. The storage check further up keeps the build-time
guard in front of the pointer test. Please can you do the same here:

    if (!CONFIG_IS_ENABLED(IMAGEMAP) || !images->imagemap || data != load)

That keeps the runtime fix for RAM-backed boots with imagemap enabled,
and lets the compiler drop the test when it is disabled. Separately,
it would be worth zeroing 'images' in spl_load_fit_image() as
vbe_common.c does, but that belongs in its own patch.

Regards,
Simon



More information about the openwrt-devel mailing list