[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] Is the use of bdrv_getlength() in qcow.c kosher?
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] Is the use of bdrv_getlength() in qcow.c kosher? |
Date: |
Mon, 7 Aug 2017 13:49:36 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 08/04/2017 10:32 AM, Eric Blake wrote:
> On 08/04/2017 07:45 AM, Markus Armbruster wrote:
>> Markus Armbruster <address@hidden> writes:
>>
>>> bdrv_getlength() can fail. The uses in qcow.c don't check. Is that
>>> safe?
>>
>> There's another one in qcow2_co_pwritev_compressed().
>>
>> Yet another one in dump_refcounts().
I haven't seen a patch for these yet, so I'll submit one shortly.
>>
>> While we're talking: the one in qcow2_measure() assigns to a variable of
>> type ssize_t. Should be int64_t.
>
> Oh indeed. I wonder if my recently-added qemu-iotests 190 will catch
> that on a 32-bit machine? If not, it should...
I can't trigger a failure, because the code in question is doing:
int64_t ssize = bdrv_getlength(in_bs);
if (ssize < 0) {
error_setg_errno(&local_err, -ssize,
"Unable to get image virtual_size");
goto err;
}
Yes, the variable name is odd, but the types look correct.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature