2009-07-13 19:52:35

by Subrata Modak

[permalink] [raw]
Subject: [PATCH] Fix compilation warning for fs/ocfs2/xattr.c

Hi,

gcc 4.4.1 generates the following build warning on i386:

CC [M] fs/ocfs2/xattr.o
fs/ocfs2/xattr.c: In function ‘ocfs2_xattr_block_get’:
fs/ocfs2/xattr.c:1055: warning: ‘block_off’ may be used uninitialized in this function

The following fix is based on a similar approach by David Howells
few days back: http://lkml.org/lkml/2009/7/9/109,

Signed-off-by: Subrata Modak<[email protected]>,
---

--- a/fs/ocfs2/xattr.c 2009-06-17 17:47:21.000000000 +0530
+++ b/fs/ocfs2/xattr.c 2009-07-14 01:02:22.000000000 +0530
@@ -1052,7 +1052,8 @@ static int ocfs2_xattr_block_get(struct
struct ocfs2_xattr_block *xb;
struct ocfs2_xattr_value_root *xv;
size_t size;
- int ret = -ENODATA, name_offset, name_len, block_off, i;
+ int ret = -ENODATA, name_offset, name_len, i;
+ int uninitialized_var(block_off);

xs->bucket = ocfs2_xattr_bucket_new(inode);
if (!xs->bucket) {

---
Regards--
Subrata


2009-07-21 00:30:07

by Joel Becker

[permalink] [raw]
Subject: Re: [PATCH] Fix compilation warning for fs/ocfs2/xattr.c

On Tue, Jul 14, 2009 at 01:19:31AM +0530, Subrata Modak wrote:
> gcc 4.4.1 generates the following build warning on i386:
>
> CC [M] fs/ocfs2/xattr.o
> fs/ocfs2/xattr.c: In function ‘ocfs2_xattr_block_get’:
> fs/ocfs2/xattr.c:1055: warning: ‘block_off’ may be used uninitialized in this function
>
> The following fix is based on a similar approach by David Howells
> few days back: http://lkml.org/lkml/2009/7/9/109,
>
> Signed-off-by: Subrata Modak<[email protected]>,

This is now in the fixes branch of ocfs2.git.

Joel

--

Life's Little Instruction Book #15

"Own a great stereo system."

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127