c313de
From c3148a408bd3c7ccf858bd5e0ac1139588847fc9 Mon Sep 17 00:00:00 2001
c313de
Message-Id: <c3148a408bd3c7ccf858bd5e0ac1139588847fc9@dist-git>
c313de
From: Jiri Denemark <jdenemar@redhat.com>
c313de
Date: Fri, 21 Jun 2019 09:25:19 +0200
c313de
Subject: [PATCH] cpu_x86: Require <cpuid> within <feature> in CPU map
c313de
MIME-Version: 1.0
c313de
Content-Type: text/plain; charset=UTF-8
c313de
Content-Transfer-Encoding: 8bit
c313de
c313de
A feature with no cpuid element is invalid and it should not be silently
c313de
treated as a feature with all CPUID bits set to zero.
c313de
c313de
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
(cherry picked from commit dbc04114f3d14b53c999bd89db51276358b1aba3)
c313de
c313de
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
c313de
c313de
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c313de
Message-Id: <ea3bbf9cb28709fe52f43ce312c0171e2a62c1e8.1561068591.git.jdenemar@redhat.com>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
---
c313de
 src/cpu/cpu_x86.c | 7 +++++++
c313de
 1 file changed, 7 insertions(+)
c313de
c313de
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
c313de
index 66aa5a612c..98e8d608d6 100644
c313de
--- a/src/cpu/cpu_x86.c
c313de
+++ b/src/cpu/cpu_x86.c
c313de
@@ -923,6 +923,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
c313de
     if (n < 0)
c313de
         goto cleanup;
c313de
 
c313de
+    if (n == 0) {
c313de
+        virReportError(VIR_ERR_INTERNAL_ERROR,
c313de
+                       _("Missing cpuid for feature %s"),
c313de
+                       feature->name);
c313de
+        goto cleanup;
c313de
+    }
c313de
+
c313de
     for (i = 0; i < n; i++) {
c313de
         ctxt->node = nodes[i];
c313de
         if (x86ParseCPUID(ctxt, &cpuid) < 0) {
c313de
-- 
c313de
2.22.0
c313de