Re: [Qemu-block] Is the use of bdrv_getlength() in qcow.c kosher?

2017-08-07 Thread Eric Blake
On 08/04/2017 10:32 AM, Eric Blake wrote:
> On 08/04/2017 07:45 AM, Markus Armbruster wrote:
>> Markus Armbruster  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(_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


Re: [Qemu-block] Is the use of bdrv_getlength() in qcow.c kosher?

2017-08-04 Thread Eric Blake
On 08/04/2017 07:45 AM, Markus Armbruster wrote:
> Markus Armbruster  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().
> 
> 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...

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



signature.asc
Description: OpenPGP digital signature


[Qemu-block] Is the use of bdrv_getlength() in qcow.c kosher?

2017-08-04 Thread Markus Armbruster
bdrv_getlength() can fail.  The uses in qcow.c don't check.  Is that
safe?



Re: [Qemu-block] Is the use of bdrv_getlength() in qcow.c kosher?

2017-08-04 Thread Markus Armbruster
Markus Armbruster  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().

While we're talking: the one in qcow2_measure() assigns to a variable of
type ssize_t.  Should be int64_t.



Re: [Qemu-block] Is the use of bdrv_getlength() in qcow.c kosher?

2017-08-04 Thread Markus Armbruster
Markus Armbruster  writes:

> bdrv_getlength() can fail.  The uses in qcow.c don't check.  Is that
> safe?

There's another one in vpc_open().