[PATCH] bootm: Fix bootz, bmi->images pointer was uninitialized

Tom Rini trini at konsulko.com
Mon May 19 23:06:08 CEST 2025


On Mon, May 19, 2025 at 09:48:00PM +0200, Benjamin ROBIN wrote:

> When building with only bootz command, without bootm, images pointer
> inside bootm_info structure is not initialized. And since this structure
> is stored in stack the generated error is kind of random, but most of
> the time this will generate: "ramdisk - allocation error"
> 
> Signed-off-by: Benjamin ROBIN <dev at benjarobin.fr>
> ---
>  boot/bootm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/boot/bootm.c b/boot/bootm.c
> index f6aa32746b7e..f6fddc151809 100644
> --- a/boot/bootm.c
> +++ b/boot/bootm.c
> @@ -1169,7 +1169,7 @@ void bootm_init(struct bootm_info *bmi)
>  {
>  	memset(bmi, '\0', sizeof(struct bootm_info));
>  	bmi->boot_progress = true;
> -	if (IS_ENABLED(CONFIG_CMD_BOOTM))
> +	if (IS_ENABLED(CONFIG_CMD_BOOTM) || IS_ENABLED(CONFIG_CMD_BOOTZ))
>  		bmi->images = &images;
>  }

Good catch. This should also get a:
Fixes: c2211ff65136 ("bootm: Add more fields to bootm_info")

And after reading the code and grepping around more, I think we should
be doing the assignment unconditionally in the function. It's what we
practically do today as only colibri_vf disables CMD_BOOTM but then also
enables any other OS boot command.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250519/1ec4e405/attachment.sig>


More information about the U-Boot mailing list