Commit dd2319c6 authored by Paolo Bonzini's avatar Paolo Bonzini

KVM: x86: warn on incorrectly NULL members of kvm_x86_ops

Use the newly corrected KVM_X86_OP annotations to warn about possible
NULL pointer dereferences as soon as the vendor module is loaded.
Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent e4fc23ba
...@@ -1545,10 +1545,13 @@ extern struct kvm_x86_ops kvm_x86_ops; ...@@ -1545,10 +1545,13 @@ extern struct kvm_x86_ops kvm_x86_ops;
static inline void kvm_ops_static_call_update(void) static inline void kvm_ops_static_call_update(void)
{ {
#define KVM_X86_OP(func) \ #define __KVM_X86_OP(func) \
static_call_update(kvm_x86_##func, kvm_x86_ops.func); static_call_update(kvm_x86_##func, kvm_x86_ops.func);
#define KVM_X86_OP_OPTIONAL KVM_X86_OP #define KVM_X86_OP(func) \
WARN_ON(!kvm_x86_ops.func); __KVM_X86_OP(func)
#define KVM_X86_OP_OPTIONAL __KVM_X86_OP
#include <asm/kvm-x86-ops.h> #include <asm/kvm-x86-ops.h>
#undef __KVM_X86_OP
} }
#define __KVM_HAVE_ARCH_VM_ALLOC #define __KVM_HAVE_ARCH_VM_ALLOC
......
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