From: Nathan Chancellor <nathan@kernel.org>
To: David Howells <dhowells@redhat.com>
Cc: llvm@lists.linux.dev, linux-kernel@vger.kernel.org,
Tom Rix <trix@redhat.com>, Nathan Chancellor <nathan@kernel.org>,
kernel test robot <lkp@intel.com>
Subject: [PATCH] netfs: Ensure ret is always initialized in netfs_begin_read()
Date: Thu, 3 Mar 2022 09:38:26 -0700 [thread overview]
Message-ID: <20220303163826.1120936-1-nathan@kernel.org> (raw)
Clang warns:
fs/netfs/io.c:630:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (sync) {
^~~~
fs/netfs/io.c:655:9: note: uninitialized use occurs here
return ret;
^~~
There is only one instance of netfs_begin_read() where sync is false and
its return value is not checked so just return 0 in this case, as there
is no return code from another function call to propagate.
Fixes: 33e1e5d53058 ("netfs: Add a function to consolidate beginning a read")
Link: https://github.com/ClangBuiltLinux/linux/issues/1607
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
fs/netfs/io.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/netfs/io.c b/fs/netfs/io.c
index 3db9356eb7c2..4a3b7989cd1c 100644
--- a/fs/netfs/io.c
+++ b/fs/netfs/io.c
@@ -651,6 +651,7 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync)
/* If we decrement nr_outstanding to 0, the ref belongs to us. */
if (atomic_dec_and_test(&rreq->nr_outstanding))
netfs_rreq_assess(rreq, false);
+ ret = 0;
}
return ret;
}
base-commit: 2522c1b16116325f69670076d0c82024fbcc4e8d
--
2.35.1
reply other threads:[~2022-03-03 16:39 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=20220303163826.1120936-1-nathan@kernel.org \
--to=nathan@kernel.org \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=trix@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.