[libvirt] [PATCH 21/26] nodeinfo: Resolve Coverity NEGATIVE_RETURNS
Peter Krempa
pkrempa at redhat.com
Thu Sep 11 09:39:52 UTC 2014
On 09/05/14 00:26, John Ferlan wrote:
> If the virNumaGetNodeCPUs() call fails with -1, then jumping to cleanup
> with 'cpus == NULL' and calling virCapabilitiesClearHostNUMACellCPUTopology
> will cause issues.
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
> src/nodeinfo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/nodeinfo.c b/src/nodeinfo.c
> index 92a3718..2008ade 100644
> --- a/src/nodeinfo.c
> +++ b/src/nodeinfo.c
> @@ -1933,7 +1933,7 @@ nodeCapsInitNUMA(virCapsPtr caps)
> ret = 0;
>
> cleanup:
> - if (topology_failed || ret < 0)
> + if ((topology_failed || ret < 0) && cpus)
> virCapabilitiesClearHostNUMACellCPUTopology(cpus, ncpus);
False positive. This function checks for NULL.
>
> virBitmapFree(cpumap);
>
Also the cleanup section frees "cpus" twice. That might be worth fixing too.
ACK
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140911/d65e9132/attachment-0001.sig>
More information about the libvir-list
mailing list