9119d9
From ecbceb91ea354cac6f1301aed88035e61ca291c0 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <ecbceb91ea354cac6f1301aed88035e61ca291c0@dist-git>
9119d9
From: John Ferlan <jferlan@redhat.com>
9119d9
Date: Mon, 15 Sep 2014 15:13:52 -0400
9119d9
Subject: [PATCH] xen: Resolve Coverity NEGATIVE_RETURNS
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1141209
9119d9
9119d9
Coverity notes that if the call to virBitmapParse() returns a negative
9119d9
value, then when we jump to the error label, the call to
9119d9
virCapabilitiesClearHostNUMACellCPUTopology() will have issues
9119d9
with the negative nb_cpus
9119d9
9119d9
Signed-off-by: John Ferlan <jferlan@redhat.com>
9119d9
(cherry picked from commit 947593f6e628f724607d51dfc346af6dc3edf01f)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/xen/xend_internal.c | 3 ++-
9119d9
 1 file changed, 2 insertions(+), 1 deletion(-)
9119d9
9119d9
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
9119d9
index 6d1fec7..5a99025 100644
9119d9
--- a/src/xen/xend_internal.c
9119d9
+++ b/src/xen/xend_internal.c
9119d9
@@ -1112,7 +1112,8 @@ sexpr_to_xend_topology(const struct sexpr *root, virCapsPtr caps)
9119d9
  parse_error:
9119d9
     virReportError(VIR_ERR_XEN_CALL, "%s", _("topology syntax error"));
9119d9
  error:
9119d9
-    virCapabilitiesClearHostNUMACellCPUTopology(cpuInfo, nb_cpus);
9119d9
+    if (nb_cpus > 0)
9119d9
+        virCapabilitiesClearHostNUMACellCPUTopology(cpuInfo, nb_cpus);
9119d9
     VIR_FREE(cpuInfo);
9119d9
     return -1;
9119d9
 }
9119d9
-- 
9119d9
2.1.0
9119d9