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

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

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]