[PATCH 05/36] cpu_x86: Require <cpuid> within <feature> in CPU map

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A feature with no cpuid element is invalid and it should not be silently
treated as a feature with all CPUID bits set to zero.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/cpu/cpu_x86.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 3b87386270..3a8e3dd37f 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -924,6 +924,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
     if (n < 0)
         goto cleanup;
 
+    if (n == 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Missing cpuid for feature %s"),
+                       feature->name);
+        goto cleanup;
+    }
+
     for (i = 0; i < n; i++) {
         ctxt->node = nodes[i];
         if (x86ParseCPUID(ctxt, &cpuid) < 0) {
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux