[PATCH v4 2/2] boot: android: Prevent use of unintialised variable

Mattijs Korpershoek mkorpershoek at kernel.org
Fri Jun 27 08:52:54 CEST 2025


Hi Andrew,

Thank you for the patch.

On Thu, Jun 26, 2025 at 17:38, Andrew Goodbody <andrew.goodbody at linaro.org> wrote:

> Initialise vhdr to prevent its use when uninitialised.
>
> This issue was found with Smatch.
>
> Fixes: e058176be32b (android: boot: add vendor boot image to prepare for v3, v4 support)
> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>

Reviewed-by: Mattijs Korpershoek <mkorpershoek at kernel.org>

> ---
>  boot/image-android.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/boot/image-android.c b/boot/image-android.c
> index 459cdb8456c..12bcf7e4fbd 100644
> --- a/boot/image-android.c
> +++ b/boot/image-android.c
> @@ -677,7 +677,7 @@ bool android_image_get_dtb_by_index(ulong hdr_addr, ulong vendor_boot_img,
>  {
>  	struct andr_image_data img_data;
>  	const struct andr_boot_img_hdr_v0 *hdr;
> -	const struct andr_vnd_boot_img_hdr *vhdr;
> +	const struct andr_vnd_boot_img_hdr *vhdr = NULL;
>  
>  	hdr = map_sysmem(hdr_addr, sizeof(*hdr));
>  	if (vendor_boot_img != -1)
>
> -- 
> 2.39.5


More information about the U-Boot mailing list