Skip to content

Commit

Permalink
btrfs: fix uninitialized variable warning in get_inode_gen
Browse files Browse the repository at this point in the history
Anybody that calls get_inode_gen() can have an uninitialized gen if
there's an error.  This isn't a big deal because all the users just exit
if they get an error, however it makes -Wmaybe-uninitialized complain,
so fix this up to always initialize the passed in gen, this quiets all
of the uninitialized warnings in send.c.

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>
  • Loading branch information
Josef Bacik authored and David Sterba committed Feb 13, 2023
1 parent 0e47b25 commit ab19901
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fs/btrfs/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,14 +956,12 @@ static int get_inode_info(struct btrfs_root *root, u64 ino,
static int get_inode_gen(struct btrfs_root *root, u64 ino, u64 *gen)
{
int ret;
struct btrfs_inode_info info;
struct btrfs_inode_info info = { 0 };

if (!gen)
return -EPERM;
ASSERT(gen);

ret = get_inode_info(root, ino, &info);
if (!ret)
*gen = info.gen;
*gen = info.gen;
return ret;
}

Expand Down

0 comments on commit ab19901

Please sign in to comment.