Skip to content

Commit d7c9e1b

Browse files
josefbacikkdave
authored andcommitted
btrfs: fix uninitialized parent in insert_state
I don't know how this isn't caught when we build this in the kernel, but while syncing extent-io-tree.c into btrfs-progs I got an error because parent could potentially be uninitialized when we link in a new node, specifically when the extent_io_tree is empty. This means we could have garbage in the parent color. I don't know what the ramifications are of that, but it's probably not great, so fix this by initializing parent to NULL. I spot checked all of our other usages in btrfs and we appear to be doing the correct thing everywhere else. Fixes: c7e118c ("btrfs: open code rbtree search in insert_state") CC: [email protected] # 6.0+ Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent a4c853a commit d7c9e1b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/extent-io-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static int insert_state(struct extent_io_tree *tree,
395395
u32 bits, struct extent_changeset *changeset)
396396
{
397397
struct rb_node **node;
398-
struct rb_node *parent;
398+
struct rb_node *parent = NULL;
399399
const u64 end = state->end;
400400

401401
set_state_bits(tree, state, bits, changeset);

0 commit comments

Comments
 (0)