From: Jesse Millan <jessem@cs.pdx.edu>
Subject: [KJ]  [PATCH] Fix gcc4 warning, size may be used uninitialized (ext2)

The function ext2_set_acl() declares a size_t called 'size' without
setting it to an initial value. 'size' is not referred to again until
you see:

if (acl) {
	// Email KJ comments: size IS initialized in this function
	// only if acl != NULL
	value = ext2_acl_to_disk(acl, &size);
	...
}

// Email KJ comments: If acl == NULL, size is passed to
// this function uninitialized.
error = ext2_xattr_set(inode, name_index, "", value, size, 0);
...

The external function ext2_xattr_set() does not seem to use size in any
meaningful way... but depending on some other parameters, it looks like
'size' could be read without being initialized.

Initializing 'size' to zero eliminates the compiler warning and the
possibility of passing an uninitialized variable around.

*Note unlike previous patches, initializing 'size' in the function
ext2_acl_to_disk() does not eliminate this particular warning. This is
because of the conditional call to the function that initializes it.




Signed-off-by: Jesse Millan <jessem@cs.pdx.edu>

---
 acl.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: quilt/fs/ext2/acl.c
===================================================================
--- quilt.orig/fs/ext2/acl.c
+++ quilt/fs/ext2/acl.c
@@ -220,7 +220,7 @@ ext2_set_acl(struct inode *inode, int ty
 	struct ext2_inode_info *ei = EXT2_I(inode);
 	int name_index;
 	void *value = NULL;
-	size_t size;
+	size_t size = 0;
 	int error;
 
 	if (S_ISLNK(inode->i_mode))
