[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 1/8] nbd: silence maybe-uninitialized warnings
From: |
Eric Blake |
Subject: |
[PULL 1/8] nbd: silence maybe-uninitialized warnings |
Date: |
Thu, 8 Oct 2020 13:59:44 -0500 |
From: Christian Borntraeger <borntraeger@de.ibm.com>
gcc 10 from Fedora 32 gives me:
Compiling C object libblock.fa.p/nbd_server.c.o
../nbd/server.c: In function ‘nbd_co_client_start’:
../nbd/server.c:625:14: error: ‘namelen’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
625 | rc = nbd_negotiate_send_info(client, NBD_INFO_NAME, namelen,
name,
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
626 | errp);
| ~~~~~
../nbd/server.c:564:14: note: ‘namelen’ was declared here
564 | uint32_t namelen;
| ^~~~~~~
cc1: all warnings being treated as errors
As I cannot see how this can happen, let uns silence the warning.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20200930155859.303148-3-borntraeger@de.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
nbd/server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nbd/server.c b/nbd/server.c
index f74766add7b7..f25cffa334fa 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -556,7 +556,7 @@ static int nbd_negotiate_handle_info(NBDClient *client,
Error **errp)
NBDExport *exp;
uint16_t requests;
uint16_t request;
- uint32_t namelen;
+ uint32_t namelen = 0;
bool sendname = false;
bool blocksize = false;
uint32_t sizes[3];
--
2.28.0
- [PULL 0/8] NBD patches through 2020-10-08, Eric Blake, 2020/10/08
- [PULL 4/8] block/nbd: fix reconnect-delay, Eric Blake, 2020/10/08
- [PULL 2/8] block/nbd: fix drain dead-lock because of nbd reconnect-delay, Eric Blake, 2020/10/08
- [PULL 5/8] block/nbd: nbd_co_reconnect_loop(): don't connect if drained, Eric Blake, 2020/10/08
- [PULL 3/8] block/nbd: correctly use qio_channel_detach_aio_context when needed, Eric Blake, 2020/10/08
- [PULL 7/8] nbd/server: Reject embedded NUL in NBD strings, Eric Blake, 2020/10/08
- [PULL 1/8] nbd: silence maybe-uninitialized warnings,
Eric Blake <=
- [PULL 6/8] qemu-nbd: Honor SIGINT and SIGHUP, Eric Blake, 2020/10/08
- [PULL 8/8] nbd: Simplify meta-context parsing, Eric Blake, 2020/10/08
- Re: [PULL 0/8] NBD patches through 2020-10-08, Peter Maydell, 2020/10/09