Skip to content

Commit

Permalink
btrfs: fix uninitialized ret in ref-verify
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
josefbacik authored and kdave committed Oct 3, 2019
1 parent 11a19a9 commit c5f4987
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/ref-verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ static int process_leaf(struct btrfs_root *root,
struct btrfs_extent_data_ref *dref;
struct btrfs_shared_data_ref *sref;
u32 count;
int i = 0, tree_block_level = 0, ret;
int i = 0, tree_block_level = 0, ret = 0;
struct btrfs_key key;
int nritems = btrfs_header_nritems(leaf);

Expand Down

0 comments on commit c5f4987

Please sign in to comment.