[libvirt] [PATCH 2/9] virsh: Resolve Coverity NEGATIVE_RETURNS

Eric Blake eblake at redhat.com
Fri Sep 12 02:59:53 UTC 2014


On 09/11/2014 06:05 PM, John Ferlan wrote:
> Coverity notes that after we VIR_ALLOC_N(params, nparams) a failed call to
> virDomainGetCPUStats could result in nparams being set to -1. In that case,
> the subsequent virTypedParamsFree in cleanup will pass -1 which isn't good.
> 
> Use the returned value as the number of stats to display in the loop as
> it will be the value reported from the hypervisor and may be less than
> nparams which is OK
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  tools/virsh-domain.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

ACK

-- 
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/20140911/54b32550/attachment-0001.sig>


More information about the libvir-list mailing list