]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
cmd: abootimg: Prevent use of unintialised variable
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Thu, 26 Jun 2025 16:38:54 +0000 (17:38 +0100)
committerMattijs Korpershoek <mkorpershoek@kernel.org>
Wed, 2 Jul 2025 10:10:04 +0000 (12:10 +0200)
Initialise vhdr to prevent its use when uninitialised.

This issue was found with Smatch.

Fixes: 636da2039aea (android: boot: support boot image header version 3 and 4)
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Link: https://lore.kernel.org/r/20250625-abootimg_fix-v4-1-df7af00e87b0@linaro.org
[mkorpershoek: fixed trivial typo in commit msg]
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
cmd/abootimg.c

index 44de00fb9c974b2e7aee4b3f1490d3adfd34b731..6fb521537867f8103d4d96759fa227f44776b638 100644 (file)
@@ -96,7 +96,7 @@ static int abootimg_get_dtb_load_addr(int argc, char *const argv[])
                return CMD_RET_USAGE;
        struct andr_image_data img_data = {0};
        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(abootimg_addr(), sizeof(*hdr));
        if (get_avendor_bootimg_addr() != -1)