]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: x86: Fix wrong return value type in guest_cpuid_has()
authorLi RongQing <lirongqing@baidu.com>
Thu, 28 May 2026 03:15:45 +0000 (23:15 -0400)
committerSean Christopherson <seanjc@google.com>
Thu, 28 May 2026 13:01:52 +0000 (06:01 -0700)
The function guest_cpuid_has() is declared with a return type of 'bool'.
However, when kvm_find_cpuid_entry_index() fails to locate a valid CPUID
entry, the code incorrectly returns 'NULL' instead of 'false'.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
Link: https://patch.msgid.link/20260528031545.1879-1-lirongqing@baidu.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/cpuid.h

index fc96ba86c644db64d0d0fd55af8f376614b97039..8d863f45585de04b9fa5e7bf886fa36b59d2a7c5 100644 (file)
@@ -126,7 +126,7 @@ static __always_inline bool guest_cpuid_has(struct kvm_vcpu *vcpu,
 
        entry = kvm_find_cpuid_entry_index(vcpu, cpuid.function, cpuid.index);
        if (!entry)
-               return NULL;
+               return false;
 
        reg = __cpuid_entry_get_reg(entry, cpuid.reg);
        if (!reg)