]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
migration: fix SEEK_CUR offset calculation in qio_channel_block_seek
authorMarco Cavenati <Marco.Cavenati@eurecom.fr>
Wed, 26 Mar 2025 16:22:30 +0000 (17:22 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Sat, 5 Apr 2025 13:51:46 +0000 (16:51 +0300)
The SEEK_CUR case in qio_channel_block_seek was incorrectly using the
'whence' parameter instead of the 'offset' parameter when calculating the
new position.

Fixes: 65cf200a51 ("migration: introduce a QIOChannel impl for BlockDriverState VMState")
Signed-off-by: Marco Cavenati <Marco.Cavenati@eurecom.fr>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Message-ID: <20250326162230.3323199-1-Marco.Cavenati@eurecom.fr>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit c0b32426ce56182c1ce2a12904f3a702c2ecc460)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
migration/channel-block.c

index f4ab53acdb5c2da9376c9366ab2e2916dbb833a6..81ec5c6ac65cd81e5a75a0e14e2d9385f75a662f 100644 (file)
@@ -122,7 +122,7 @@ qio_channel_block_seek(QIOChannel *ioc,
         bioc->offset = offset;
         break;
     case SEEK_CUR:
-        bioc->offset += whence;
+        bioc->offset += offset;
         break;
     case SEEK_END:
         error_setg(errp, "Size of VMstate region is unknown");