render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From 4b8dbdb81eb6a755dc58b359e65b769ee1dc3f86 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <4b8dbdb81eb6a755dc58b359e65b769ee1dc3f86@dist-git>
a41c76
From: Michal Privoznik <mprivozn@redhat.com>
a41c76
Date: Fri, 24 Jan 2020 15:05:49 +0100
a41c76
Subject: [PATCH] cpu.c: Check properly for virCapabilitiesGetNodeInfo() retval
a41c76
a41c76
The virCapabilitiesGetNodeInfo() function has the usual return
a41c76
value semantics for integeres: a negative value means an error,
a41c76
zero or a positive value means success. However, the function
a41c76
call done in virCPUProbeHost() doesn't check for the return value
a41c76
accordingly.
a41c76
a41c76
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
a41c76
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
a41c76
(cherry picked from commit 609acf1f5d5d666148355719346c8ee05f911e33)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1794691
a41c76
a41c76
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
a41c76
Message-Id: <033f07f79bc9fa26f669c83f9aa790bfaef25b93.1579874719.git.mprivozn@redhat.com>
a41c76
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu.c | 2 +-
a41c76
 1 file changed, 1 insertion(+), 1 deletion(-)
a41c76
a41c76
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
a41c76
index a2ae5b8c07..d99466472b 100644
a41c76
--- a/src/cpu/cpu.c
a41c76
+++ b/src/cpu/cpu.c
a41c76
@@ -455,7 +455,7 @@ virCPUProbeHost(virArch arch)
a41c76
 {
a41c76
     virNodeInfo nodeinfo;
a41c76
 
a41c76
-    if (virCapabilitiesGetNodeInfo(&nodeinfo))
a41c76
+    if (virCapabilitiesGetNodeInfo(&nodeinfo) < 0)
a41c76
         return NULL;
a41c76
 
a41c76
     return virCPUGetHost(arch, VIR_CPU_TYPE_HOST, &nodeinfo, NULL);
a41c76
-- 
a41c76
2.25.0
a41c76