[libvirt] [PATCH v2 06/12] qemu: fix bugs in blockstats

Eric Blake eblake at redhat.com
Tue Dec 16 23:53:01 UTC 2014


On 12/16/2014 06:17 AM, John Ferlan wrote:
> 
> Ran the series through my local Coverity checker.... found one issue....
> 

>> -                                                  format, NULL)))
>> +    if (format == VIR_STORAGE_FILE_RAW) {
>> +        disk->src->capacity = disk->src->physical;
>> +    } else if (!(meta = virStorageFileGetMetadataFromBuf(disk->src->path, buf,
>> +                                                         len, format, NULL))) {
>>          goto endjob;
>> -    if (meta->capacity)
>> -        disk->src->capacity = meta->capacity;
>> +        disk->src->capacity = meta->capacity ? meta->capacity
>> +            : disk->src->physical;
> 
> We'll never get to this line because of the goto endjob (which gets
> propagated in next patch as goto cleanup).

Here's what I re-wrote this to:


    if (format == VIR_STORAGE_FILE_RAW)
        src->capacity = src->physical;
    else if ((meta = virStorageFileGetMetadataFromBuf(disk->src->path, buf,
                                                        len, format, NULL)))
        src->capacity = meta->capacity ? meta->capacity : src->physical;
    else
        goto endjob;

I didn't see an explicit ACK on this patch, but as 7/12 is the same
material just refactored, I'll go ahead and push the corrected form of
this at the same time as that one.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141216/cd33036f/attachment-0001.sig>


More information about the libvir-list mailing list