qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org
Cc: "Song Gao" <gaosong@loongson.cn>, "Peter Xu" <peterx@redhat.com>,
	"Bin Meng" <bmeng.cn@gmail.com>,
	"Mahmoud Mandour" <ma.mandourr@gmail.com>,
	"Hyman Huang" <yong.huang@smartx.com>,
	"Klaus Jensen" <its@irrelevant.dk>,
	"Alexandre Iooss" <erdnaxe@crans.org>,
	"Alex Benné e" <alex.bennee@linaro.org>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Daniel P. Berrangé " <berrange@redhat.com>,
	"John Snow" <jsnow@redhat.com>,
	"Jesper Devantier" <foss@defmacro.it>,
	"Bin Meng" <bin.meng@windriver.com>, "Greg Kurz" <groug@kaod.org>,
	"Eugenio Pé rez" <eperezma@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Yuval Shaia" <yuval.shaia.ml@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Philippe Mathieu-Daudé " <philmd@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
	"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Keith Busch" <kbusch@kernel.org>,
	"Eric Blake" <eblake@redhat.com>,
	qemu-block@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Gerd Hoffmann" <kraxel@redhat.com>, "Fam Zheng" <fam@euphon.net>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Stefano Garzarella" <sgarzare@redhat.com>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH v2 06/22] block/mirror: fix -Werror=maybe-uninitialized false-positive
Date: Thu, 26 Sep 2024 07:45:19 +0300	[thread overview]
Message-ID: <kelf6.0oxhf800l0an@linaro.org> (raw)
In-Reply-To: <20240924130554.749278-7-marcandre.lureau@redhat.com>

On Tue, 24 Sep 2024 16:05, marcandre.lureau@redhat.com wrote:
>From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
>../block/mirror.c:404:5: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized]
>../block/mirror.c:895:12: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized]
>../block/mirror.c:578:12: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized]
>
>Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>---
> block/mirror.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/block/mirror.c b/block/mirror.c
>index 54e3a7ea9d..fd55a580fb 100644
>--- a/block/mirror.c
>+++ b/block/mirror.c
>@@ -349,7 +349,7 @@ static void coroutine_fn mirror_co_read(void *opaque)
>     MirrorOp *op = opaque;
>     MirrorBlockJob *s = op->s;
>     int nb_chunks;
>-    uint64_t ret;
>+    uint64_t ret = -1;

This doesn't look right, `ret` should be int. It receives the return 
result of bdrv_co_preadv() which is int and is passed as an int argument 
to mirror_read_complete().

Not related to this patch obviously. But since you're touching this code 
maybe we could include this small cleanup?


>     uint64_t max_bytes;
> 
>     max_bytes = s->granularity * s->max_iov;
>@@ -565,7 +565,7 @@ static void coroutine_fn GRAPH_UNLOCKED mirror_iteration(MirrorBlockJob *s)
> 
>     bitmap_set(s->in_flight_bitmap, offset / s->granularity, nb_chunks);
>     while (nb_chunks > 0 && offset < s->bdev_length) {
>-        int ret;
>+        int ret = -1;
>         int64_t io_bytes;
>         int64_t io_bytes_acct;
>         MirrorMethod mirror_method = MIRROR_METHOD_COPY;
>@@ -841,7 +841,7 @@ static int coroutine_fn GRAPH_UNLOCKED mirror_dirty_init(MirrorBlockJob *s)
>     int64_t offset;
>     BlockDriverState *bs;
>     BlockDriverState *target_bs = blk_bs(s->target);
>-    int ret;
>+    int ret = -1;
>     int64_t count;
> 
>     bdrv_graph_co_rdlock();
>-- 
>2.45.2.827.g557ae147e6
>
>


  reply	other threads:[~2024-09-26  4:50 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 13:05 [PATCH v2 00/22] -Werror=maybe-uninitialized fixes marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 01/22] util/coroutine: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 02/22] util/timer: " marcandre.lureau
2024-09-26  4:39   ` Manos Pitsidianakis
2024-09-24 13:05 ` [PATCH v2 03/22] hw/qxl: fix -Werror=maybe-uninitialized false-positives marcandre.lureau
2024-09-26  4:40   ` Manos Pitsidianakis
2024-09-24 13:05 ` [PATCH v2 04/22] nbd: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 05/22] block/mirror: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 06/22] " marcandre.lureau
2024-09-26  4:45   ` Manos Pitsidianakis [this message]
2024-09-24 13:05 ` [PATCH v2 07/22] block/stream: fix -Werror=maybe-uninitialized false-positives marcandre.lureau
2024-09-26  4:50   ` Manos Pitsidianakis
2024-09-24 13:05 ` [PATCH v2 08/22] hw/ahci: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-26  4:52   ` Manos Pitsidianakis
2024-09-24 13:05 ` [PATCH v2 09/22] hw/vhost-scsi: fix -Werror=maybe-uninitialized marcandre.lureau
2024-09-25  7:57   ` Stefano Garzarella
2024-09-24 13:05 ` [PATCH v2 10/22] hw/sdhci: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 11/22] block/block-copy: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 12/22] migration: fix -Werror=maybe-uninitialized false-positives marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 13/22] hw/virtio-blk: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-25  7:59   ` Stefano Garzarella
2024-09-24 13:05 ` [PATCH v2 14/22] migration: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 15/22] linux-user/hppa: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 16/22] target/loongarch: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 17/22] tests: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 18/22] hw/virtio: " marcandre.lureau
2024-09-25  8:07   ` Stefano Garzarella
2024-09-27 13:07     ` Eugenio Perez Martin
2024-09-30  8:11       ` Stefano Garzarella
2024-09-30  8:30         ` Eugenio Perez Martin
2024-09-27 13:04   ` Eugenio Perez Martin
2024-09-30  8:08     ` Stefano Garzarella
2024-09-24 13:05 ` [PATCH v2 19/22] block: " marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 20/22] qom/object: fix -Werror=maybe-uninitialized marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 21/22] fsdep/9p: fix -Werror=maybe-uninitialized false-positive marcandre.lureau
2024-09-24 13:05 ` [PATCH v2 22/22] RFC: hw/virtio: a potential leak fix marcandre.lureau
2024-09-25  8:18   ` Stefano Garzarella
2024-09-24 13:08 ` [PATCH v2 00/22] -Werror=maybe-uninitialized fixes Daniel P. Berrangé
  -- strict thread matches above, loose matches on Subject: below --
2024-09-24 13:01 marcandre.lureau
2024-09-24 13:02 ` [PATCH v2 06/22] block/mirror: fix -Werror=maybe-uninitialized false-positive marcandre.lureau

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=kelf6.0oxhf800l0an@linaro.org \
    --to=manos.pitsidianakis@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=bin.meng@windriver.com \
    --cc=bmeng.cn@gmail.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=eperezma@redhat.com \
    --cc=erdnaxe@crans.org \
    --cc=fam@euphon.net \
    --cc=farosas@suse.de \
    --cc=foss@defmacro.it \
    --cc=gaosong@loongson.cn \
    --cc=groug@kaod.org \
    --cc=hreitz@redhat.com \
    --cc=its@irrelevant.dk \
    --cc=jsnow@redhat.com \
    --cc=kbusch@kernel.org \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=ma.mandourr@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    --cc=yong.huang@smartx.com \
    --cc=yuval.shaia.ml@gmail.com \
    /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).