* [PATCH] ceph: fix uninitialized return code
@ 2019-07-08 13:48 Arnd Bergmann
2019-07-08 14:50 ` Nathan Chancellor
2019-07-08 17:16 ` Jeff Layton
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2019-07-08 13:48 UTC (permalink / raw)
To: Yan, Zheng, Sage Weil, Ilya Dryomov
Cc: Arnd Bergmann, David Howells, Al Viro, Jeff Layton,
Luis Henriques, ceph-devel, linux-kernel, clang-built-linux
clang points out a -Wsometimed-uninitized bug in the modified
ceph_real_mount() function:
fs/ceph/super.c:850:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (!fsc->sb->s_root) {
^~~~~~~~~~~~~~~~
fs/ceph/super.c:885:9: note: uninitialized use occurs here
return err;
^~~
fs/ceph/super.c:850:2: note: remove the 'if' if its condition is always true
if (!fsc->sb->s_root) {
^~~~~~~~~~~~~~~~~~~~~~
fs/ceph/super.c:843:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
Set it to zero if the condition is false.
Fixes: 108f95bfaa56 ("vfs: Convert ceph to use the new mount API")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
fs/ceph/super.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 0d23903ddfa5..d663aa1286f6 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -876,6 +876,8 @@ static int ceph_real_mount(struct fs_context *fc, struct ceph_fs_client *fsc)
goto out;
}
fsc->sb->s_root = root;
+ } else {
+ err = 0;
}
fc->root = dget(fsc->sb->s_root);
--
2.20.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ceph: fix uninitialized return code
2019-07-08 13:48 [PATCH] ceph: fix uninitialized return code Arnd Bergmann
@ 2019-07-08 14:50 ` Nathan Chancellor
2019-07-08 17:16 ` Jeff Layton
1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2019-07-08 14:50 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Yan, Zheng, Sage Weil, Ilya Dryomov, David Howells, Al Viro,
Jeff Layton, Luis Henriques, ceph-devel, linux-kernel,
clang-built-linux
On Mon, Jul 08, 2019 at 03:48:08PM +0200, Arnd Bergmann wrote:
> clang points out a -Wsometimed-uninitized bug in the modified
> ceph_real_mount() function:
>
> fs/ceph/super.c:850:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> if (!fsc->sb->s_root) {
> ^~~~~~~~~~~~~~~~
> fs/ceph/super.c:885:9: note: uninitialized use occurs here
> return err;
> ^~~
> fs/ceph/super.c:850:2: note: remove the 'if' if its condition is always true
> if (!fsc->sb->s_root) {
> ^~~~~~~~~~~~~~~~~~~~~~
> fs/ceph/super.c:843:9: note: initialize the variable 'err' to silence this warning
> int err;
> ^
> = 0
>
> Set it to zero if the condition is false.
>
> Fixes: 108f95bfaa56 ("vfs: Convert ceph to use the new mount API")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks for the patch!
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ceph: fix uninitialized return code
2019-07-08 13:48 [PATCH] ceph: fix uninitialized return code Arnd Bergmann
2019-07-08 14:50 ` Nathan Chancellor
@ 2019-07-08 17:16 ` Jeff Layton
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2019-07-08 17:16 UTC (permalink / raw)
To: Arnd Bergmann, Yan, Zheng, Sage Weil, Ilya Dryomov
Cc: David Howells, Al Viro, Luis Henriques, ceph-devel, linux-kernel,
clang-built-linux
On Mon, 2019-07-08 at 15:48 +0200, Arnd Bergmann wrote:
> clang points out a -Wsometimed-uninitized bug in the modified
> ceph_real_mount() function:
>
> fs/ceph/super.c:850:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> if (!fsc->sb->s_root) {
> ^~~~~~~~~~~~~~~~
> fs/ceph/super.c:885:9: note: uninitialized use occurs here
> return err;
> ^~~
> fs/ceph/super.c:850:2: note: remove the 'if' if its condition is always true
> if (!fsc->sb->s_root) {
> ^~~~~~~~~~~~~~~~~~~~~~
> fs/ceph/super.c:843:9: note: initialize the variable 'err' to silence this warning
> int err;
> ^
> = 0
>
> Set it to zero if the condition is false.
>
> Fixes: 108f95bfaa56 ("vfs: Convert ceph to use the new mount API")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> fs/ceph/super.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index 0d23903ddfa5..d663aa1286f6 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -876,6 +876,8 @@ static int ceph_real_mount(struct fs_context *fc, struct ceph_fs_client *fsc)
> goto out;
> }
> fsc->sb->s_root = root;
> + } else {
> + err = 0;
> }
>
> fc->root = dget(fsc->sb->s_root);
I see 108f95bfaa56 linux-next, but this hasn't been merged into the ceph
kclient tree yet. It'd be ideal if Al just squashed this in before
sending the PR to Linus.
In any case, patch looks fine:
Reviewed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-08 17:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-08 13:48 [PATCH] ceph: fix uninitialized return code Arnd Bergmann
2019-07-08 14:50 ` Nathan Chancellor
2019-07-08 17:16 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox