From: Arnd Bergmann <arnd@arndb.de>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Arnd Bergmann <arnd@arndb.de>, Vivek Goyal <vgoyal@redhat.com>,
Andreas Gruenbacher <agruenba@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Konstantin Khlebnikov <koct9i@gmail.com>,
Antonio Murdaca <amurdaca@redhat.com>,
Maxim Patlasov <mpatlasov@virtuozzo.com>,
linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] overlayfs: fix ovl_get_redirect() error handling
Date: Tue, 22 Nov 2016 15:29:13 +0100 [thread overview]
Message-ID: <20161122142921.1801734-1-arnd@arndb.de> (raw)
The newly introduced ovl_get_redirect() function returns an unintialized
variable when kmalloc() fails:
fs/overlayfs/dir.c: In function ‘ovl_set_redirect’:
fs/overlayfs/overlayfs.h:92:6: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
This makes it return -ENOMEM instead.
Fixes: 496654b0792e ("ovl: redirect on rename-dir")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
fs/overlayfs/dir.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index bc7c62c7a72f..fb9fce0112f0 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -798,8 +798,10 @@ static char *ovl_get_redirect(struct dentry *dentry, bool samedir)
}
buf = kmalloc(buflen, GFP_TEMPORARY);
- if (!buf)
+ if (!buf) {
+ ret = ERR_PTR(-ENOMEM);
goto out;
+ }
buflen--;
buf[buflen] = '\0';
--
2.9.0
reply other threads:[~2016-11-22 14:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161122142921.1801734-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=agruenba@redhat.com \
--cc=amurdaca@redhat.com \
--cc=koct9i@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mpatlasov@virtuozzo.com \
--cc=vgoyal@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®