[PATCH RFC netfs] Fix uninitialized variable in netfs_retry_read_subrequests()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Cc: David Howells <dhowells@xxxxxxxxxx>
Cc: Jeff Layton <jlayton@xxxxxxxxxx>
Cc: <netfs@xxxxxxxxxxxxxxx>
Cc: <linux-fsdevel@xxxxxxxxxxxxxxx>

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.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux