qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 11/19] migration/block: fix -Werror=maybe-uninitialized false-pos


From: marcandre . lureau
Subject: [PATCH 11/19] migration/block: fix -Werror=maybe-uninitialized false-positive
Date: Thu, 28 Mar 2024 14:20:44 +0400

From: Marc-André Lureau <marcandre.lureau@redhat.com>

../migration/block.c:966:16: error: ‘ret’ may be used uninitialized 
[-Werror=maybe-uninitialized]

Given that "cluster_size" must be <= BLK_MIG_BLOCK_SIZE, the previous
loop is entered at least once, so 'ret' is assigned a value in all conditions.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 migration/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/block.c b/migration/block.c
index 2b9054889a..486b1bec03 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -877,7 +877,7 @@ static int block_load(QEMUFile *f, void *opaque, int 
version_id)
     uint8_t *buf;
     int64_t total_sectors = 0;
     int nr_sectors;
-    int ret;
+    int ret = -EINVAL;
     BlockDriverInfo bdi;
     int cluster_size = BLK_MIG_BLOCK_SIZE;
 
-- 
2.44.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]