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