render / rpms / libvirt

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