[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/22] block/mirror: fix -Werror=maybe-uninitialized false-positiv
From: |
marcandre . lureau |
Subject: |
[PULL 06/22] block/mirror: fix -Werror=maybe-uninitialized false-positive |
Date: |
Wed, 2 Oct 2024 12:36:29 +0400 |
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]
Change a variable to int, as suggested by Manos: "bdrv_co_preadv()
which is int and is passed as an int argument to mirror_read_complete()"
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
block/mirror.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
index 54e3a7ea9d..2afe700b4d 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;
+ int ret = -1;
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
- [PULL 00/22] -Werror=maybe-uninitialized fixes, marcandre . lureau, 2024/10/02
- [PULL 01/22] util/coroutine: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 02/22] util/timer: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 03/22] hw/qxl: fix -Werror=maybe-uninitialized false-positives, marcandre . lureau, 2024/10/02
- [PULL 04/22] nbd: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 05/22] block/mirror: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 06/22] block/mirror: fix -Werror=maybe-uninitialized false-positive,
marcandre . lureau <=
- [PULL 07/22] block/stream: fix -Werror=maybe-uninitialized false-positives, marcandre . lureau, 2024/10/02
- [PULL 08/22] hw/ahci: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 09/22] hw/vhost-scsi: fix -Werror=maybe-uninitialized, marcandre . lureau, 2024/10/02
- [PULL 10/22] hw/sdhci: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 11/22] block/block-copy: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 12/22] migration: fix -Werror=maybe-uninitialized false-positives, marcandre . lureau, 2024/10/02
- [PULL 13/22] hw/virtio-blk: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 14/22] migration: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 15/22] linux-user/hppa: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02
- [PULL 16/22] target/loongarch: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/10/02