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