* linux-next: build warning from Linus' tree
@ 2011-06-03 1:00 Stephen Rothwell
2011-06-03 14:50 ` [PATCH] btrfs: fix uninitialized variable warning David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2011-06-03 1:00 UTC (permalink / raw)
To: Chris Mason
Cc: linux-next, linux-kernel, Miao Xie, David Sterba, Tsutomu Itoh,
Itaru Kitayama
[-- Attachment #1: Type: text/plain, Size: 465 bytes --]
Hi all,
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 16cdcec736cd ("btrfs: implement delayed inode items
operation").
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] btrfs: fix uninitialized variable warning
2011-06-03 1:00 linux-next: build warning from Linus' tree Stephen Rothwell
@ 2011-06-03 14:50 ` David Sterba
2011-06-03 14:56 ` Chris Mason
0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2011-06-03 14:50 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Chris Mason, linux-next, linux-kernel, Miao Xie, David Sterba,
Tsutomu Itoh, Itaru Kitayama, linux-btrfs
From: David Sterba <dsterba@suse.cz>
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 16cdcec736cd ("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 <sfr@canb.auug.org.au>
Signed-off-by: David Sterba <dsterba@suse.cz>
---
patch pushed to git://repo.or.cz/linux-2.6/btrfs-unstable.git #fixes
fs/btrfs/delayed-inode.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 01e2950..8cb012f 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -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))
--
1.7.5.2.353.g5df3e
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: fix uninitialized variable warning
2011-06-03 14:50 ` [PATCH] btrfs: fix uninitialized variable warning David Sterba
@ 2011-06-03 14:56 ` Chris Mason
0 siblings, 0 replies; 3+ messages in thread
From: Chris Mason @ 2011-06-03 14:56 UTC (permalink / raw)
To: dave
Cc: Stephen Rothwell, linux-next, linux-kernel, Miao Xie,
Tsutomu Itoh, Itaru Kitayama, linux-btrfs
Excerpts from David Sterba's message of 2011-06-03 10:50:14 -0400:
> From: David Sterba <dsterba@suse.cz>
>
> 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 16cdcec736cd ("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.
Ugh, thanks! It looks like the gcc uninit stuff isn't as verbose as it
used to be, but it does catch a bunch of allocated/set but not used
vars.
I have a nitems = 0 fix in my tree as well.
-chris
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-03 14:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-03 1:00 linux-next: build warning from Linus' tree Stephen Rothwell
2011-06-03 14:50 ` [PATCH] btrfs: fix uninitialized variable warning David Sterba
2011-06-03 14:56 ` Chris Mason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).