Re: fs/netfs/read_retry.c:235:20: error: variable 'subreq' is uninitialized when used here [-Werror,-Wuninitialized]

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

 



On Tue, Nov 26, 2024, at 09:25, Naresh Kamboju wrote:
> The x86_64 builds failed with clang-19 and clang-nightly on the Linux
> next-20241125 tag.
> Same build pass with gcc-13.

> Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
>
> Build error:
> ---------
> fs/netfs/read_retry.c:235:20: error: variable 'subreq' is
> uninitialized when used here [-Werror,-Wuninitialized]
>   235 |         if (list_is_last(&subreq->rreq_link, &stream->subrequests))
>       |                           ^~~~~~
> fs/netfs/read_retry.c:28:36: note: initialize the variable 'subreq' to
> silence this warning
>    28 |         struct netfs_io_subrequest *subreq;
>       |                                           ^
>       |                                            = NULL
> 1 error generated.
> make[5]: *** [scripts/Makefile.build:194: fs/netfs/read_retry.o] Error 1


This broke in 1bd9011ee163 ("netfs: Change the read result
collector to only use one work item"), which introduced an
extra "subreq" variable in the "do {} while()" loop that
shadows the one in the function body.

The one pointed out by the compiler is not initialized
anywhere. My best guess is that the extra declaration should
just be removed here:

--- a/fs/netfs/read_retry.c
+++ b/fs/netfs/read_retry.c
@@ -72,7 +72,7 @@ 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;

This also removes an initialization to NULL, but I think
that was not needed regardless.

       Arnd




[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