From 609acf1f5d5d666148355719346c8ee05f911e33 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 24 Jan 2020 10:22:13 +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 --- 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 d9288cc85a..ae3a0acc10 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -456,7 +456,7 @@ virCPUProbeHost(virArch arch) { virNodeInfo nodeinfo; - if (virCapabilitiesGetNodeInfo(&nodeinfo)) + if (virCapabilitiesGetNodeInfo(&nodeinfo) < 0) return NULL; return virCPUGetHost(arch, VIR_CPU_TYPE_HOST, &nodeinfo, NULL);