From ac7afbeb9efbb4a227e249dfaadcf85034258a51 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Wed, 13 Oct 2010 11:42:19 +0200 Subject: [PATCH] cpu: Fix vendor for recent CPU models Recent CPU models were specified using invalid vendor element NAME, 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 edbb21c193..75c65225cb 100644 --- a/src/cpu/cpu_map.xml +++ b/src/cpu/cpu_map.xml @@ -355,7 +355,7 @@ - Intel + @@ -386,7 +386,7 @@ - Intel + @@ -419,7 +419,7 @@ - Intel + @@ -454,7 +454,7 @@ - AMD + @@ -483,7 +483,7 @@ - AMD + @@ -516,7 +516,7 @@ - AMD + diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 813b49901a..a329b1cf3b 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"),