diff options
author | Arnd Bergmann <arnd@arndb.de> | 2019-06-17 08:39:29 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2019-06-18 09:06:16 -0400 |
commit | 1dac6f5b0ed2601be21bb4e27a44b0c3e667b7f4 (patch) | |
tree | 01be29628073cabaf679bdfb672c9903833c677d | |
parent | 9179c21dc6ed1c993caa5fe4da876a6765c26af7 (diff) |
ovl: fix bogus -Wmaybe-unitialized warning
gcc gets a bit confused by the logic in ovl_setup_trap() and
can't figure out whether the local 'trap' variable in the caller
was initialized or not:
fs/overlayfs/super.c: In function 'ovl_fill_super':
fs/overlayfs/super.c:1333:4: error: 'trap' may be used uninitialized in this function [-Werror=maybe-uninitialized]
iput(trap);
^~~~~~~~~~
fs/overlayfs/super.c:1312:17: note: 'trap' was declared here
Reword slightly to make it easier for the compiler to understand.
Fixes: 146d62e5a586 ("ovl: detect overlapping layers")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r-- | fs/overlayfs/super.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 9b18e0f9016a..69888df10c90 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
@@ -995,8 +995,8 @@ static int ovl_setup_trap(struct super_block *sb, struct dentry *dir, | |||
995 | int err; | 995 | int err; |
996 | 996 | ||
997 | trap = ovl_get_trap_inode(sb, dir); | 997 | trap = ovl_get_trap_inode(sb, dir); |
998 | err = PTR_ERR(trap); | 998 | err = PTR_ERR_OR_ZERO(trap); |
999 | if (IS_ERR(trap)) { | 999 | if (err) { |
1000 | if (err == -ELOOP) | 1000 | if (err == -ELOOP) |
1001 | pr_err("overlayfs: conflicting %s path\n", name); | 1001 | pr_err("overlayfs: conflicting %s path\n", name); |
1002 | return err; | 1002 | return err; |