Message ID | 20200324105315.136569-5-wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: Fixes for valgrind errors during fsck-tests | expand |
diff --git a/extent-tree.c b/extent-tree.c index dc4b052c1666..f0cb9faa4da6 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -1564,7 +1564,7 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans) { struct btrfs_block_group_cache *cache; struct btrfs_path *path; - int ret; + int ret = 0; path = btrfs_alloc_path(); if (!path)
[BUG] Valgrind reports the following error for fsck/007, which is only repairable for original mode: ==97599== Conditional jump or move depends on uninitialised value(s) ==97599== at 0x1D4A42: btrfs_commit_transaction (transaction.c:207) ==97599== by 0x16475C: check_extent_refs (main.c:8097) ==97599== by 0x166199: check_chunks_and_extents (main.c:8786) ==97599== by 0x166441: do_check_chunks_and_extents (main.c:8842) ==97599== by 0x169D13: cmd_check (main.c:10324) ==97599== by 0x11CDC6: cmd_execute (commands.h:125) ==97599== by 0x11D712: main (btrfs.c:386) ==97599== [CAUSE] If btrfs_write_dirty_block_groups() get called with no block group dirtied (no dirty extents created), the return value of it is uninitialized, as the stack @ret is not initialized at all. [FIX] Initialize @ret to 0 for btrfs_write_dirty_block_groups() as if there is no dirty block groups, we do nothing and shouldn't fail. Signed-off-by: Qu Wenruo <wqu@suse.com> --- extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)