diff mbox

Build warning 'uninitialized variable' in fs/overlayfs

Message ID 20170517202649.szj7ygjfnsgdpzl3@yury-N73SV
State New
Headers show

Commit Message

Yury Norov May 17, 2017, 8:26 p.m. UTC
Hi Amir,

(Sorry for new email, but I cannot find your patch in my mailbox,
though found it in next-20170517)

Your patch 02cac3227a282 (ovl: mark upper dir with type origin entries
"impure") makes gcc warn on uninitialized variables in my arm64 build:
fs/overlayfs/dir.c: In function ‘ovl_rename’:
fs/overlayfs/dir.c:1060:2: warning: ‘newdentry’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
dput(newdentry);
^~~~~~~~~~~~~~~
fs/overlayfs/dir.c:1062:2: warning: ‘olddentry’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
dput(olddentry);
^~~~~~~~~~~~~~~

The patch below fixes warnings for me. But I'm not familiar to the
subsystem and so not sure that the fix is correct.

Yury

Comments

Amir Goldstein May 17, 2017, 10:17 p.m. UTC | #1
On Wed, May 17, 2017 at 11:26 PM, Yury Norov <ynorov@caviumnetworks.com> wrote:
> Hi Amir,

>

> (Sorry for new email, but I cannot find your patch in my mailbox,

> though found it in next-20170517)

>

> Your patch 02cac3227a282 (ovl: mark upper dir with type origin entries

> "impure") makes gcc warn on uninitialized variables in my arm64 build:

> fs/overlayfs/dir.c: In function ‘ovl_rename’:

> fs/overlayfs/dir.c:1060:2: warning: ‘newdentry’ may be used

> uninitialized in this function [-Wmaybe-uninitialized]

> dput(newdentry);

> ^~~~~~~~~~~~~~~

> fs/overlayfs/dir.c:1062:2: warning: ‘olddentry’ may be used

> uninitialized in this function [-Wmaybe-uninitialized]

> dput(olddentry);

> ^~~~~~~~~~~~~~~

>

> The patch below fixes warnings for me. But I'm not familiar to the

> subsystem and so not sure that the fix is correct.

>

It's not. Should be goto out_revert_creds;

Already sent a fix for that.
Thanks!
diff mbox

Patch

diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 5ad6ccf2159e..19ee4d294b5e 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -973,13 +973,13 @@  static int ovl_rename(struct inode *olddir, struct dentry *old,
 		if (ovl_type_origin(old) && !ovl_type_merge(new->d_parent)) {
 			err = ovl_set_impure(new->d_parent, new_upperdir);
 			if (err)
-				goto out_dput;
+				goto out_unlock;
 		}
 		if (!overwrite && ovl_type_origin(new) &&
 		    !ovl_type_merge(old->d_parent)) {
 			err = ovl_set_impure(old->d_parent, old_upperdir);
 			if (err)
-				goto out_dput;
+				goto out_unlock;
 		}
 	}