qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org, armbru@redhat.com,
	mreitz@redhat.com, nsoffer@redhat.com, jsnow@redhat.com
Subject: Re: [PATCH] qcow2: Expose bitmaps' size during measure
Date: Fri, 17 Apr 2020 08:20:22 -0500	[thread overview]
Message-ID: <d2ba25e8-3586-b966-3715-1cb6757029d8@redhat.com> (raw)
In-Reply-To: <a995b3cc-e17a-58ef-f778-9edeb21b4623@redhat.com>

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

>> The full log is available at
>> http://patchew.org/logs/20200416212349.731404-1-eblake@redhat.com/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	other threads:[~2020-04-17 13:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 21:23 [PATCH] qcow2: Expose bitmaps' size during measure Eric Blake
2020-04-16 21:47 ` Eric Blake
2020-04-16 22:49 ` no-reply
2020-04-17  0:17   ` Eric Blake
2020-04-17 13:20     ` Eric Blake [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2ba25e8-3586-b966-3715-1cb6757029d8@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=nsoffer@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).