From: Eric Blake <eblake@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-trivial@nongnu.org, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH 1/2] block/block-copy: Fix uninitialized variable in block_copy_task_entry
Date: Thu, 7 May 2020 10:57:07 -0500 [thread overview]
Message-ID: <b39d671f-f399-c482-851e-c6c77cab94de@redhat.com> (raw)
In-Reply-To: <20200507121129.29760-2-philmd@redhat.com>
On 5/7/20 7:11 AM, Philippe Mathieu-Daudé wrote:
> Fix when building with -Os:
>
> CC block/block-copy.o
> block/block-copy.c: In function ‘block_copy_task_entry’:
> block/block-copy.c:428:38: error: ‘error_is_read’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 428 | t->call_state->error_is_read = error_is_read;
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
>
Looks like -Os triggered different inlining of block_copy_do_copy(). I
confirm that block_copy_do_copy does NOT initialize error_is_read except
when returning < 0, but similarly block_copy_task_entry() does not read
error_is_read except in the same setups. So it looks like no actual bug
was triggered, but we can definitely aid the compiler's analysis by
initializing.
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> block/block-copy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-05-07 15:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-07 12:11 [PATCH 0/2] block/block-copy: Fix uninitialized variable in block_copy_task_entry Philippe Mathieu-Daudé
2020-05-07 12:11 ` Philippe Mathieu-Daudé
2020-05-07 12:11 ` [PATCH 1/2] " Philippe Mathieu-Daudé
2020-05-07 12:11 ` Philippe Mathieu-Daudé
2020-05-07 15:57 ` Eric Blake [this message]
2020-05-07 12:11 ` [PATCH 2/2] block/block-copy: Simplify block_copy_do_copy() Philippe Mathieu-Daudé
2020-05-07 12:11 ` Philippe Mathieu-Daudé
2020-05-07 15:57 ` Eric Blake
2020-05-14 15:03 ` [PATCH 0/2] block/block-copy: Fix uninitialized variable in block_copy_task_entry Philippe Mathieu-Daudé
2020-05-14 15:03 ` Philippe Mathieu-Daudé
2020-05-14 16:19 ` Kevin Wolf
2020-05-14 16:19 ` Kevin Wolf
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=b39d671f-f399-c482-851e-c6c77cab94de@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.