]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
boot: android: Prevent use of unintialised variable
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Thu, 26 Jun 2025 16:38:55 +0000 (17:38 +0100)
committerMattijs Korpershoek <mkorpershoek@kernel.org>
Wed, 2 Jul 2025 10:10:25 +0000 (12:10 +0200)
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@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Link: https://lore.kernel.org/r/20250625-abootimg_fix-v4-2-df7af00e87b0@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
boot/image-android.c

index 14cf611cee5fd117cd54bd2982bfea4a797c048a..1cd2060bb3fdc85ff5f1dd81111ddc7663bf3b57 100644 (file)
@@ -680,7 +680,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)