]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fs: btrfs: initialize @ret to 0 to prevent uninitialized return value
authorQu Wenruo <wqu@suse.com>
Sat, 31 Oct 2020 01:07:51 +0000 (09:07 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 19 Nov 2020 14:45:49 +0000 (09:45 -0500)
In show_dir() if we hit a ROOT_ITEM, we can exit with uninitialized
@ret.

Fix it by initializing it to 0.

Reported-by: Coverity CID 312955
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Marek BehĂșn <marek.behun@nic.cz>
fs/btrfs/btrfs.c

index e48972ffa21ae4897e48e0f2ec946091052cfcf9..346b2c4341c225d25a1e64ec4b74346a2f7baca9 100644 (file)
@@ -36,7 +36,7 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
        char *target = NULL;
        char filetime[32];
        time_t mtime;
-       int ret;
+       int ret = 0;
 
        btrfs_dir_item_key_to_cpu(eb, di, &key);