From 4891c4e595b48ee41b7d8062bb599d05a938ea0a Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Sat, 31 Oct 2020 09:07:51 +0800 Subject: [PATCH] fs: btrfs: initialize @ret to 0 to prevent uninitialized return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Behún --- fs/btrfs/btrfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c index e48972ffa2..346b2c4341 100644 --- a/fs/btrfs/btrfs.c +++ b/fs/btrfs/btrfs.c @@ -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); -- 2.39.5