OSDN Git Service

target/i386: Check kvm_hyperv_expand_features() return value
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Wed, 13 Sep 2023 09:30:03 +0000 (11:30 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 Sep 2023 10:16:40 +0000 (12:16 +0200)
In case more code is added after the kvm_hyperv_expand_features()
call, check its return value (since it can fail).

Fixes: 071ce4b03b ("i386: expand Hyper-V features during CPU feature expansion time")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20230913093009.83520-2-philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/cpu.c

index 24ee67b..bd6a932 100644 (file)
@@ -7121,8 +7121,8 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
         env->cpuid_xlevel2 = env->cpuid_min_xlevel2;
     }
 
-    if (kvm_enabled()) {
-        kvm_hyperv_expand_features(cpu, errp);
+    if (kvm_enabled() && !kvm_hyperv_expand_features(cpu, errp)) {
+        return;
     }
 }