btrfs: fix uninitialized variable warnings in __set_extent_bit and convert_extent_bit
authorJosef Bacik <josef@toxicpanda.com>
Fri, 16 Dec 2022 20:15:55 +0000 (15:15 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Feb 2023 16:50:33 +0000 (17:50 +0100)
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>
fs/btrfs/extent-io-tree.c

index 3c7766dfaa694a45fdc82bf8d6704318813b0110..b2bab76723404b577548f72f47c7cbf16885702a 100644 (file)
@@ -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;
@@ -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;