summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2018-03-27 16:05:17 -0500
committerEric Blake <eblake@redhat.com>2018-04-02 08:45:21 -0500
commit00d96a4612f81e82c181fe821d527e98abcbac07 (patch)
treedeab23533921cef2da3f8379068683c701f6e350
parentf184de7553272223d6af731d7d623a7cebf710b5 (diff)
downloadfocaccia-qemu-00d96a4612f81e82c181fe821d527e98abcbac07.tar.gz
focaccia-qemu-00d96a4612f81e82c181fe821d527e98abcbac07.zip
nbd: Fix 32-bit compilation on BLOCK_STATUS
iotests 123 and 209 fail on 32-bit platforms.  The culprit:
sizeof(extent) is wrong; we want sizeof(*extent).  But since
the struct is 8 bytes, it happened to work on 64-bit platforms
where the pointer is also 8 bytes (nasty).

Fixes: 78a33ab58
Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180327210517.1804242-1-eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
-rw-r--r--block/nbd-client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/nbd-client.c b/block/nbd-client.c
index e64e346d69..e7caf49fbb 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -239,7 +239,7 @@ static int nbd_parse_blockstatus_payload(NBDClientSession *client,
 {
     uint32_t context_id;
 
-    if (chunk->length != sizeof(context_id) + sizeof(extent)) {
+    if (chunk->length != sizeof(context_id) + sizeof(*extent)) {
         error_setg(errp, "Protocol error: invalid payload for "
                          "NBD_REPLY_TYPE_BLOCK_STATUS");
         return -EINVAL;