[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/19] block/stream: fix -Werror=maybe-uninitialized false-positi
From: |
marcandre . lureau |
Subject: |
[PATCH 06/19] block/stream: fix -Werror=maybe-uninitialized false-positives |
Date: |
Thu, 28 Mar 2024 14:20:39 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
../block/stream.c:193:19: error: ‘unfiltered_bs’ may be used uninitialized
[-Werror=maybe-uninitialized]
../block/stream.c:176:5: error: ‘len’ may be used uninitialized
[-Werror=maybe-uninitialized]
trace/trace-block.h:906:9: error: ‘ret’ may be used uninitialized
[-Werror=maybe-uninitialized]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
block/stream.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/stream.c b/block/stream.c
index 7031eef12b..9076203193 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -155,8 +155,8 @@ static void stream_clean(Job *job)
static int coroutine_fn stream_run(Job *job, Error **errp)
{
StreamBlockJob *s = container_of(job, StreamBlockJob, common.job);
- BlockDriverState *unfiltered_bs;
- int64_t len;
+ BlockDriverState *unfiltered_bs = NULL;
+ int64_t len = -1;
int64_t offset = 0;
int error = 0;
int64_t n = 0; /* bytes */
@@ -177,7 +177,7 @@ static int coroutine_fn stream_run(Job *job, Error **errp)
for ( ; offset < len; offset += n) {
bool copy;
- int ret;
+ int ret = -1;
/* Note that even when no rate limit is applied we need to yield
* with no pending I/O here so that bdrv_drain_all() returns.
--
2.44.0
- [PATCH 00/19] -Werror=maybe-uninitialized fixes, marcandre . lureau, 2024/03/28
- [PATCH 01/19] util/coroutine: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 02/19] util/timer: with -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 03/19] hw/qxl: fix -Werror=maybe-uninitialized false-positives, marcandre . lureau, 2024/03/28
- [PATCH 04/19] nbd: with -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 05/19] block/mirror: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 06/19] block/stream: fix -Werror=maybe-uninitialized false-positives,
marcandre . lureau <=
- [PATCH 07/19] hw/ahci: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 08/19] hw/vhost-scsi: fix -Werror=maybe-uninitialized, marcandre . lureau, 2024/03/28
- [PATCH 09/19] hw/sdhci: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 10/19] hw/rdma: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 11/19] migration/block: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 12/19] migration: fix -Werror=maybe-uninitialized false-positives, marcandre . lureau, 2024/03/28