Skip to content

Commit

Permalink
btrfs: fix uninitialized variable warning
Browse files Browse the repository at this point in the history
With Linus' tree, today's linux-next build (powercp ppc64_defconfig)
produced this warning:

fs/btrfs/delayed-inode.c: In function 'btrfs_delayed_update_inode':
fs/btrfs/delayed-inode.c:1598:6: warning: 'ret' may be used
uninitialized in this function

Introduced by commit 16cdcec ("btrfs: implement delayed inode items
operation").

This fixes a bug in btrfs_update_inode(): if the returned value from
btrfs_delayed_update_inode is a nonzero garbage, inode stat data are not
updated and several call paths may hit a BUG_ON or fail with strange
code.

Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave authored and chrismason-xx committed Jun 4, 2011
1 parent 7841cb2 commit aa0467d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/delayed-inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct inode *inode)
{
struct btrfs_delayed_node *delayed_node;
int ret;
int ret = 0;

delayed_node = btrfs_get_or_create_delayed_node(inode);
if (IS_ERR(delayed_node))
Expand Down

0 comments on commit aa0467d

Please sign in to comment.