[libvirt PATCH 02/28] cpu_x86: Ignore alias names

Tim Wiederhake twiederh at redhat.com
Wed Oct 19 16:56:02 UTC 2022


A later patch will add alias names to the feature map. Ignore them for now.

Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/cpu/cpu_x86.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 4d2379803c..d2560de497 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1089,7 +1089,7 @@ static int
 x86ParseDataItemList(virCPUx86Data *cpudata,
                      xmlNodePtr node)
 {
-    size_t i;
+    size_t i = 0;
 
     if (xmlChildElementCount(node) <= 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no x86 CPU data found"));
@@ -1097,9 +1097,14 @@ x86ParseDataItemList(virCPUx86Data *cpudata,
     }
 
     node = xmlFirstElementChild(node);
-    for (i = 0; node; ++i) {
+    while (node) {
         virCPUx86DataItem item;
 
+        if (virXMLNodeNameEqual(node, "alias")) {
+            node = xmlNextElementSibling(node);
+            continue;
+        }
+
         if (virXMLNodeNameEqual(node, "cpuid")) {
             if (x86ParseCPUID(node, &item) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1116,6 +1121,7 @@ x86ParseDataItemList(virCPUx86Data *cpudata,
 
         if (virCPUx86DataAddItem(cpudata, &item) < 0)
             return -1;
+        ++i;
 
         node = xmlNextElementSibling(node);
     }
-- 
2.36.1



More information about the libvir-list mailing list