[PATCH 21/26] nodeinfo: Resolve Coverity NEGATIVE_RETURNS

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

 



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@xxxxxxxxxx>
---
 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);
 
     virBitmapFree(cpumap);
-- 
1.9.3

--
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]