From: Arnd Bergmann <arnd@arndb.de>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ext4: disable retry logic in ext4_set_encrypted_filename
Date: Sat, 02 Jan 2016 20:50:11 +0100 [thread overview]
Message-ID: <3125077.SmBO9VTSER@wuerfel> (raw)
gcc correctly warns that the ctx variable in ext4_set_encrypted_filename
has gone out of scope in ext4_set_encrypted_filename if we enter the
retry path and a 'goto' into the previous code block can not guarantee
to get the contents back:
fs/ext4/namei.c: In function 'ext4_set_encrypted_filename':
fs/ext4/namei.c:4035:10: warning: 'ctx' may be used uninitialized in this function [-Wmaybe-uninitialized]
retval = ext4_xattr_set_handle(handle, inode,
I tried moving the variable declaration to the start of the function,
but that does not shut up the warning, as it's apparently too hard
for the compiler to follow the control flow and determine that it's
correct (or for me reading the code, for that matter).
This adds a hack to avoid the undefined behavior at the cost of
losing the chance to retry on a spurious -ENOSPC error. We probably
need a better solution.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 374431bae296 ("ext4 crypto: add ioctls to allow backup of encryption metadata")
---
The warning appeared with next-20121231, which is the latest next release,
nevermind if it has already been fixed in the meantime.
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index c03f310200d6..fd2bd090bdfa 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -4113,7 +4113,7 @@ out:
}
if (handle)
ext4_journal_stop(handle);
- if (do_retry) {
+ if (do_retry /* FIXME: ctx is invalid */ && 0) {
do_retry = 0;
goto retry;
}
next reply other threads:[~2016-01-02 19:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-02 19:50 Arnd Bergmann [this message]
2016-01-03 3:54 ` [PATCH] ext4: disable retry logic in ext4_set_encrypted_filename Theodore Ts'o
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=3125077.SmBO9VTSER@wuerfel \
--to=arnd@arndb.de \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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