Message ID | 20240328102052.3499331-12-marcandre.lureau@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | -Werror=maybe-uninitialized fixes | expand |
On Thu, Mar 28, 2024 at 02:20:44PM +0400, marcandre.lureau@redhat.com wrote: > 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> Acked-by: Peter Xu <peterx@redhat.com>
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;