Skip to content

Commit c5f4987

Browse files
josefbacikkdave
authored andcommitted
btrfs: fix uninitialized ret in ref-verify
Coverity caught a case where we could return with a uninitialized value in ret in process_leaf. This is actually pretty likely because we could very easily run into a block group item key and have a garbage value in ret and think there was an errror. Fix this by initializing ret to 0. Reported-by: Colin Ian King <[email protected]> Fixes: fd708b8 ("Btrfs: add a extent ref verify tool") CC: [email protected] # 4.19+ Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 11a19a9 commit c5f4987

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/ref-verify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static int process_leaf(struct btrfs_root *root,
500500
struct btrfs_extent_data_ref *dref;
501501
struct btrfs_shared_data_ref *sref;
502502
u32 count;
503-
int i = 0, tree_block_level = 0, ret;
503+
int i = 0, tree_block_level = 0, ret = 0;
504504
struct btrfs_key key;
505505
int nritems = btrfs_header_nritems(leaf);
506506

0 commit comments

Comments
 (0)