[PATCH] cpu: break out when a right cpuCandidate found

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

 



>From 8123c5d64f940fa0fb0de32fc5e68035980b6b01 Mon Sep 17 00:00:00 2001
From: WangYufei <james.wangyufei@xxxxxxxxxx>
Date: Thu, 13 Feb 2014 07:17:11 +0000
Subject: [PATCH] cpu: break out when a right cpuCandidate found

In function x86Decode there's a code segment in while cycle like this:
        if (cpuModel == NULL
            || cpuModel->nfeatures > cpuCandidate->nfeatures) {
            virCPUDefFree(cpuModel);
            cpuModel = cpuCandidate;
            cpuData = candidate->data;
        } else {
            virCPUDefFree(cpuCandidate);
        }
when it finds the right cpuCandidate, it doesn't break out the cycle, but continues
run in it, and cpuModel will never get a new value, it's meaningless. It should
break out when a right cpuCndidate found.

Signed-off-by: WangYufei <james.wangyufei@xxxxxxxxxx>
---
 src/cpu/cpu_x86.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 56080ef..546b757 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1558,6 +1558,7 @@ x86Decode(virCPUDefPtr cpu,
             virCPUDefFree(cpuModel);
             cpuModel = cpuCandidate;
             cpuData = candidate->data;
+            break;
         } else {
             virCPUDefFree(cpuCandidate);
         }
-- 
1.7.12.4

Best Regards,
-WangYufei



--
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]