Skip to contentSkip to conversation

btrfs: uninitialized data is check_path_shared()

PATCH New Dan Carpenter 1 participant 1 message Jun 1, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: uninitialized data is check_path_shared()

refs can be used with uninitialized data if btrfs_lookup_extent_info() fails on the first pass through the loop. In the original code if that happens then check_path_shared() probably returns 1, but with this patch it will continue through the loop.

I'm not super familiar with this code so please look it over carefully.

fs/btrfs/inode.c +1 -1
index fa6ccc1..9640dae 100644
@@ -2673,7 +2673,7 @@ static int check_path_shared(struct btrfs_root *root,
 	struct extent_buffer *eb;
 	int level;
 	int ret;
-	u64 refs;
+	u64 refs = 0;
 
 	for (level = 0; level < BTRFS_MAX_LEVEL; level++) {
 		if (!path->nodes[level])