Commit 92508878 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: x86: Fix pointer mistmatch warning when patching RET0 static calls

Cast kvm_x86_ops.func to 'void *' when updating KVM static calls that are
conditionally patched to __static_call_return0().  clang complains about
using mismatching pointers in the ternary operator, which breaks the
build when compiling with CONFIG_KVM_WERROR=y.

  >> arch/x86/include/asm/kvm-x86-ops.h:82:1: warning: pointer type mismatch
  ('bool (*)(struct kvm_vcpu *)' and 'void *') [-Wpointer-type-mismatch]

Fixes: 5be2226f ("KVM: x86: allow defining return-0 static calls")
Reported-by: default avatarLike Xu <like.xu.linux@gmail.com>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Reviewed-by: default avatarDavid Dunn <daviddunn@google.com>
Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
Message-Id: <20220223162355.3174907-1-seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent e45cce30
...@@ -1548,8 +1548,8 @@ static inline void kvm_ops_static_call_update(void) ...@@ -1548,8 +1548,8 @@ static inline void kvm_ops_static_call_update(void)
WARN_ON(!kvm_x86_ops.func); __KVM_X86_OP(func) WARN_ON(!kvm_x86_ops.func); __KVM_X86_OP(func)
#define KVM_X86_OP_OPTIONAL __KVM_X86_OP #define KVM_X86_OP_OPTIONAL __KVM_X86_OP
#define KVM_X86_OP_OPTIONAL_RET0(func) \ #define KVM_X86_OP_OPTIONAL_RET0(func) \
static_call_update(kvm_x86_##func, kvm_x86_ops.func ? : \ static_call_update(kvm_x86_##func, (void *)kvm_x86_ops.func ? : \
(void *) __static_call_return0); (void *)__static_call_return0);
#include <asm/kvm-x86-ops.h> #include <asm/kvm-x86-ops.h>
#undef __KVM_X86_OP #undef __KVM_X86_OP
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment