[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb54084d-6d4e-4cda-8941-addc8c8898f5@paulmck-laptop>
Date: Wed, 18 Dec 2024 10:43:55 -0800
From: "Paul E. McKenney" <paulmck@...nel.org>
To: dhowells@...hat.com, jlayton@...nel.org
Cc: netfs@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, sfr@...b.auug.org.au,
linux-next@...r.kernel.org
Subject: [PATCH RFC netfs] Fix uninitialized variable in
netfs_retry_read_subrequests()
Hello!
This should actually be considered more of a bug report than a patch.
Clang 18.1.8 (but not GCC 11.5.0) complains that the "subreq" local
variable can be used uninitialized in netfs_retry_read_subrequests(),
just after the abandon_after label. This function is unusual in having
three instances of this local variable. The third and last one is clearly
erroneous because there is a branch out of the enclosing do-while loop
to the end of this function, and it looks like the intent is that the
code at the end of this function be using the same value of the "subreq"
local variable as is used within that do-while loop.
Therefore, take the obvious (if potentially quite misguided) approach
of removing the third declaration of "subreq", instead simply setting
it to NULL.
Not-yet-signed-off-by: Paul E. McKenney <paulmck@...nel.org>
Cc: David Howells <dhowells@...hat.com>
Cc: Jeff Layton <jlayton@...nel.org>
Cc: <netfs@...ts.linux.dev>
Cc: <linux-fsdevel@...r.kernel.org>
diff --git a/fs/netfs/read_retry.c b/fs/netfs/read_retry.c
index 8ca0558570c14..eba684b408df1 100644
--- a/fs/netfs/read_retry.c
+++ b/fs/netfs/read_retry.c
@@ -72,12 +72,14 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq)
next = stream->subrequests.next;
do {
- struct netfs_io_subrequest *subreq = NULL, *from, *to, *tmp;
+ struct netfs_io_subrequest *from, *to, *tmp;
struct iov_iter source;
unsigned long long start, len;
size_t part;
bool boundary = false;
+ subreq = NULL;
+
/* Go through the subreqs and find the next span of contiguous
* buffer that we then rejig (cifs, for example, needs the
* rsize renegotiating) and reissue.
Powered by blists - more mailing lists