[Top][All Lists]

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

Re: [Qemu-block] [Qemu-devel] [PATCH v5 14/18] qcow2: Switch qcow2_measu

From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v5 14/18] qcow2: Switch qcow2_measure() to byte-based iteration
Date: Fri, 14 Jul 2017 11:48:30 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/13/2017 01:49 PM, John Snow wrote:
> On 07/12/2017 09:05 PM, Eric Blake wrote:
>> This is new code, but it is easier to read if it makes passes over
>> the image using bytes rather than sectors (and will get easier in
>> the future when bdrv_get_block_status is converted to byte-based).
>> While at it, fix a bug in the computation of nb_sectors using MAX
>> rather than MIN and thus always passing INT_MAX (thankfully, the
>> bug was harmless, as bdrv_get_block_status_above() clamps its
>> answers according to image size).
> Well, unless ssize was >= 2^40, and then it wouldn't have chosen
> INT_MAX, right!?

But then it would have wrapped the value around while assigning it to
'int nb_sectors'.  I suppose for some very-interesting size images, you
could get nb_sectors to turn into a negative value?  At any rate, it's
good the bug was short-lived.

>> Signed-off-by: Eric Blake <address@hidden>
> Reviewed-by: John Snow <address@hidden>

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

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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