render / rpms / libvirt

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