]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
fat: initialize ret in disk_rw()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 29 Apr 2026 15:54:18 +0000 (17:54 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 4 May 2026 20:35:10 +0000 (14:35 -0600)
If fat_sect_size = 0 and nr_sect = 0, the value of ret is never initialized.
A random return value is returned.

Initialize ret to 0.

Addresses-Coverity-ID: - 645495 Uninitialized scalar variable
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
fs/fat/fat.c

index 31c136e3b9edff25f3dc51e3d55a6199a96f05ba..c1ccf30771ae7a4f4a32a12d693b474909662a74 100644 (file)
@@ -71,7 +71,7 @@ static inline __u32 sect_to_block(__u32 sect, __u32 *off)
 
 static int disk_rw(__u32 sect, __u32 nr_sect, void *buf, bool read)
 {
-       int ret;
+       int ret = 0;
        __u8 *block = NULL;
        __u32 rem, size, s, n;
        const ulong blksz = cur_part_info.blksz;