Blob Blame History Raw
From 79b6cde136f9f067bfc2ef2477525218f2c4ca19 Mon Sep 17 00:00:00 2001
Message-Id: <79b6cde136f9f067bfc2ef2477525218f2c4ca19@dist-git>
From: Andrea Bolognani <abologna@redhat.com>
Date: Wed, 5 Aug 2015 18:18:32 +0200
Subject: [PATCH] nodeinfo: Check for errors when reading core_id

(cherry picked from commit f86c45ca0c10c84c954ed201531ab31129d9c9c3)

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1213713

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/nodeinfo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 6c8849d..8b56376 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -511,7 +511,9 @@ virNodeParseNode(const char *node,
             /* logical cpu is equivalent to a core on s390 */
             core = cpu;
         } else {
-            core = virNodeGetCpuValue(node, cpu, "topology/core_id", 0);
+            if ((core = virNodeGetCpuValue(node, cpu,
+                                           "topology/core_id", 0)) < 0)
+                goto cleanup;
         }
         if (core > ID_MAX) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-- 
2.5.0