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