qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] qcow2: Expose bitmaps' size during measure


From: Eric Blake
Subject: Re: [PATCH] qcow2: Expose bitmaps' size during measure
Date: Fri, 17 Apr 2020 08:20:22 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 4/16/20 7:17 PM, Eric Blake wrote:

The full log is available at
http://patchew.org/logs/address@hidden/testing.docker-quick@centos7/?type=message.

I see:

--- /tmp/qemu-test/src/tests/qemu-iotests/190.out    2020-04-16 21:15:51.000000000 +0000 +++ /tmp/qemu-test/build/tests/qemu-iotests/190.out.bad    2020-04-16 22:45:47.504493172 +0000
@@ -4,6 +4,7 @@
  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2199023255552
  required size: 2199023255552
  fully allocated size: 2199023255552
+bitmaps size: 4846791580151137091
  required size: 335806464

which looks suspiciously like an uninitialized variable leaking through when there are no bitmaps to be measured.  I'll fix it in v2.

Here's what I'm squashing in:

diff --git i/block/crypto.c w/block/crypto.c
index d577f89659fa..4e0f3ec97f0e 100644
--- i/block/crypto.c
+++ w/block/crypto.c
@@ -535,7 +535,7 @@ static BlockMeasureInfo *block_crypto_measure(QemuOpts *opts, * Unallocated blocks are still encrypted so allocation status makes no
      * difference to the file size.
      */
-    info = g_new(BlockMeasureInfo, 1);
+    info = g_new0(BlockMeasureInfo, 1);
     info->fully_allocated = luks_payload_size + size;
     info->required = luks_payload_size + size;
     return info;
diff --git i/block/qcow2.c w/block/qcow2.c
index eba6c2511e60..8d7a9e87fba0 100644
--- i/block/qcow2.c
+++ w/block/qcow2.c
@@ -4808,7 +4808,7 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
         required = virtual_size;
     }

-    info = g_new(BlockMeasureInfo, 1);
+    info = g_new0(BlockMeasureInfo, 1);
     info->fully_allocated =
         qcow2_calc_prealloc_size(virtual_size, cluster_size,
ctz32(refcount_bits)) + luks_payload_size;
diff --git i/block/raw-format.c w/block/raw-format.c
index 93b25e1b6b0b..4bb54f4ac6c5 100644
--- i/block/raw-format.c
+++ w/block/raw-format.c
@@ -346,7 +346,7 @@ static BlockMeasureInfo *raw_measure(QemuOpts *opts, BlockDriverState *in_bs,
                             BDRV_SECTOR_SIZE);
     }

-    info = g_new(BlockMeasureInfo, 1);
+    info = g_new0(BlockMeasureInfo, 1);
     info->required = required;

     /* Unallocated sectors count towards the file size in raw images */


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

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