forked from Mirrors/btrfs-progs
btrfs-progs: check/original: Fix uninitialized return value from btrfs_write_dirty_block_groups()
[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> Signed-off-by: David Sterba <dsterba@suse.com>
parent
3c2dbee299
commit
3972c27db6
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue