[PATCH 23/26] xen: Resolve Coverity NEGATIVE_RETURNS

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

 



Coverity notes that if the call to virBitmapParse() returns a negative
value, then when we jump to the error label, the call to
virCapabilitiesClearHostNUMACellCPUTopology() will have issues
with the negative nb_cpus

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/xen/xend_internal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index d9e76fc..f1322c4 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -1112,7 +1112,8 @@ sexpr_to_xend_topology(const struct sexpr *root, virCapsPtr caps)
  parse_error:
     virReportError(VIR_ERR_XEN_CALL, "%s", _("topology syntax error"));
  error:
-    virCapabilitiesClearHostNUMACellCPUTopology(cpuInfo, nb_cpus);
+    if (nb_cpus > 0)
+        virCapabilitiesClearHostNUMACellCPUTopology(cpuInfo, nb_cpus);
     VIR_FREE(cpuInfo);
     return -1;
 }
-- 
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]