Skip to content

Commit

Permalink
btrfs: fix uninitialized variable warnings in __set_extent_bit and co…
Browse files Browse the repository at this point in the history
…nvert_extent_bit

We will pass in the parent and p pointer into our tree_search function
to avoid doing a second search when inserting a new extent state into
the tree.  However because this is conditional upon passing in these
pointers the compiler seems to think these values can be uninitialized
if we're using -Wmaybe-uninitialized.  Fix this by initializing these
values.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Josef Bacik authored and David Sterba committed Feb 13, 2023
1 parent efbf35a commit 5986432
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/btrfs/extent-io-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,8 +972,8 @@ static int __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
{
struct extent_state *state;
struct extent_state *prealloc = NULL;
struct rb_node **p;
struct rb_node *parent;
struct rb_node **p = NULL;
struct rb_node *parent = NULL;
int err = 0;
u64 last_start;
u64 last_end;
Expand Down Expand Up @@ -1218,8 +1218,8 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
{
struct extent_state *state;
struct extent_state *prealloc = NULL;
struct rb_node **p;
struct rb_node *parent;
struct rb_node **p = NULL;
struct rb_node *parent = NULL;
int err = 0;
u64 last_start;
u64 last_end;
Expand Down

0 comments on commit 5986432

Please sign in to comment.