From mboxrd@z Thu Jan 1 00:00:00 1970 From: Qu Wenruo Date: Sat, 31 Oct 2020 09:07:52 +0800 Subject: [PATCH 4/4] fs: btrfs: initialize @ii in show_dir() to make coverity happy In-Reply-To: <20201031010752.23974-1-wqu@suse.com> References: <20201031010752.23974-1-wqu@suse.com> Message-ID: <20201031010752.23974-5-wqu@suse.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In show_dir() if we hit file type FT_CHRDEV or FT_BLKDEV, we expect an BTRFS_INODE_ITEM_KEY, and for that case, we should have @ii filled with data read from disk. We even have ASSERT() for this purpose, but unfortunately coverity can't understand the ASSERT() nor if we get key type BTRFS_INODE_ITEM_KEY, previous if() branch must go to the read_extent_buffer() branch to fill the @ii. So to make coverity happy, just initialize the variable @ii to all zero. Reported-by: Coverity CID 312950 Signed-off-by: Qu Wenruo --- 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 346b2c4341c2..1abd2c291177 100644 --- a/fs/btrfs/btrfs.c +++ b/fs/btrfs/btrfs.c @@ -19,7 +19,7 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb, struct btrfs_dir_item *di) { struct btrfs_fs_info *fs_info = root->fs_info; - struct btrfs_inode_item ii; + struct btrfs_inode_item ii = { 0 }; struct btrfs_key key; static const char* dir_item_str[] = { [BTRFS_FT_REG_FILE] = "FILE", -- 2.29.1