From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: [PULL 2/5] tests/unit/test-block-iothread: fix maybe-uninitialized error on GCC 11
Date: Sun, 21 Mar 2021 18:18:30 +0100 [thread overview]
Message-ID: <20210321171833.20736-3-thuth@redhat.com> (raw)
In-Reply-To: <20210321171833.20736-1-thuth@redhat.com>
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
When building qemu with GCC 11, test-block-iothread produces the following
warning:
../tests/unit/test-block-iothread.c:148:11: error: ‘buf’ may be used
uninitialized [-Werror=maybe-uninitialized]
This is caused by buf[512] left uninitialized and passed to
bdrv_save_vmstate() that expects a const uint8_t *, so the compiler
assumes it will be read and expects the parameter to be initialized.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210319112218.49609-1-eesposit@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/unit/test-block-iothread.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
index 3f866a35c6..8cf172cb7a 100644
--- a/tests/unit/test-block-iothread.c
+++ b/tests/unit/test-block-iothread.c
@@ -89,7 +89,7 @@ static void test_sync_op_pread(BdrvChild *c)
static void test_sync_op_pwrite(BdrvChild *c)
{
- uint8_t buf[512];
+ uint8_t buf[512] = { 0 };
int ret;
/* Success */
@@ -117,7 +117,7 @@ static void test_sync_op_blk_pread(BlockBackend *blk)
static void test_sync_op_blk_pwrite(BlockBackend *blk)
{
- uint8_t buf[512];
+ uint8_t buf[512] = { 0 };
int ret;
/* Success */
@@ -141,7 +141,7 @@ static void test_sync_op_load_vmstate(BdrvChild *c)
static void test_sync_op_save_vmstate(BdrvChild *c)
{
- uint8_t buf[512];
+ uint8_t buf[512] = { 0 };
int ret;
/* Error: Driver does not support snapshots */
--
2.27.0
next prev parent reply other threads:[~2021-03-21 17:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-21 17:18 [PULL 0/5] Unit test fixes + misc OS patches Thomas Huth
2021-03-21 17:18 ` [PULL 1/5] docs/devel/testing.rst: Fix references to unit tests Thomas Huth
2021-03-21 17:18 ` Thomas Huth [this message]
2021-03-21 17:18 ` [PULL 3/5] configure: fix for SunOS based systems Thomas Huth
2021-03-21 17:18 ` [PULL 4/5] contrib: ivshmem client and server build fix for SunOS Thomas Huth
2021-03-21 17:18 ` [PULL 5/5] FreeBSD: Upgrade to 12.2 release Thomas Huth
2021-03-22 11:24 ` [PULL 0/5] Unit test fixes + misc OS patches Peter Maydell
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=20210321171833.20736-3-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).