[PATCH] fs/ecryptfs/inode.c warnings

From: Connor H
Date: Mon May 09 2011 - 01:49:21 EST


Warnings popped up in fs/ecryptfs/inode.c with 2.6.39-rc6

fs/ecryptfs/inode.c: In function 'ecryptfs_do_create':
fs/ecryptfs/inode.c:72: warning: 'dentry_save' may be used
uninitialized in this function
fs/ecryptfs/inode.c:72: note: 'dentry_save' was declared here
fs/ecryptfs/inode.c:73: warning: 'vfsmount_save' may be used
uninitialized in this function
fs/ecryptfs/inode.c:73: note: 'vfsmount_save' was declared here
fs/ecryptfs/inode.c:74: warning: 'flags_save' may be used
uninitialized in this function
fs/ecryptfs/inode.c:74: note: 'flags_save' was declared here

patch sets rc to error and removes the need for two if statements.

-Connor

--- a/fs/ecryptfs/inode.c       2011-05-03 23:28:26.000000000 +0000
+++ b/fs/ecryptfs/inode.c       2011-05-08 22:10:43.000000000 +0000
@@ -69,21 +69,18 @@
 {
       struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
       struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
-       struct dentry *dentry_save;
-       struct vfsmount *vfsmount_save;
-       unsigned int flags_save;
-       int rc;
+       int rc = -EIO;

       if (nd) {
-               dentry_save = nd->path.dentry;
-               vfsmount_save = nd->path.mnt;
-               flags_save = nd->flags;
+               struct dentry *dentry_save = nd->path.dentry;
+               struct vfsmount *vfsmount_save = nd->path.mnt;
+               unsigned int flags_save = nd->flags;
               nd->path.dentry = lower_dentry;
               nd->path.mnt = lower_mnt;
               nd->flags &= ~LOOKUP_OPEN;
-       }
-       rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd);
-       if (nd) {
+
+               rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd);
+
               nd->path.dentry = dentry_save;
               nd->path.mnt = vfsmount_save;
               nd->flags = flags_save;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/