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

[libvirt] [PATCH] cpu: Fix vendor for recent CPU models



Recent CPU models were specified using invalid vendor element
<vendor>NAME</vendor>, which was silently ignored due to a bug in the
code which was parsing it.
---
 src/cpu/cpu_map.xml |   12 ++++++------
 src/cpu/cpu_x86.c   |   11 +++++++++--
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index edbb21c..75c6522 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -355,7 +355,7 @@
     </model>
 
     <model name='Conroe'>
-      <vendor>Intel</vendor>
+      <vendor name='Intel'/>
       <feature name='sse2'/>
       <feature name='sse'/>
       <feature name='fxsr'/>
@@ -386,7 +386,7 @@
     </model>
 
     <model name='Penryn'>
-      <vendor>Intel</vendor>
+      <vendor name='Intel'/>
       <feature name='sse2'/>
       <feature name='sse'/>
       <feature name='fxsr'/>
@@ -419,7 +419,7 @@
     </model>
 
     <model name='Nehalem'>
-      <vendor>Intel</vendor>
+      <vendor name='Intel'/>
       <feature name='sse2'/>
       <feature name='sse'/>
       <feature name='fxsr'/>
@@ -454,7 +454,7 @@
     </model>
 
     <model name='Opteron_G1'>
-      <vendor>AMD</vendor>
+      <vendor name='AMD'/>
       <feature name='sse2'/>
       <feature name='sse'/>
       <feature name='fxsr'/>
@@ -483,7 +483,7 @@
     </model>
 
     <model name='Opteron_G2'>
-      <vendor>AMD</vendor>
+      <vendor name='AMD'/>
       <feature name='sse2'/>
       <feature name='sse'/>
       <feature name='fxsr'/>
@@ -516,7 +516,7 @@
     </model>
 
     <model name='Opteron_G3'>
-      <vendor>AMD</vendor>
+      <vendor name='AMD'/>
       <feature name='sse2'/>
       <feature name='sse'/>
       <feature name='fxsr'/>
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 1937901..26a5c3f 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1015,8 +1015,15 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
                sizeof(*model->cpuid) * model->ncpuid);
     }
 
-    vendor = virXPathString("string(./vendor/@name)", ctxt);
-    if (vendor) {
+    if (virXPathBoolean("boolean(./vendor)", ctxt)) {
+        vendor = virXPathString("string(./vendor/@name)", ctxt);
+        if (!vendor) {
+            virCPUReportError(VIR_ERR_INTERNAL_ERROR,
+                    _("Invalid vendor element in CPU model %s"),
+                    model->name);
+            goto ignore;
+        }
+
         if (!(model->vendor = x86VendorFind(map, vendor))) {
             virCPUReportError(VIR_ERR_INTERNAL_ERROR,
                     _("Unknown vendor %s referenced by CPU model %s"),
-- 
1.7.3.1


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