[PATCH] KVM: VMX: WARN on invalid vmptrld or vmclear

From: Paolo Bonzini
Date: Fri Jul 19 2019 - 12:42:36 EST


Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
arch/x86/kvm/vmx/ops.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/ops.h b/arch/x86/kvm/vmx/ops.h
index 2200fb698dd0..b143cee701c3 100644
--- a/arch/x86/kvm/vmx/ops.h
+++ b/arch/x86/kvm/vmx/ops.h
@@ -186,7 +186,7 @@ static inline void vmcs_clear(struct vmcs *vmcs)

asm volatile (__ex("vmclear %1") CC_SET(na)
: CC_OUT(na) (error) : "m"(phys_addr));
- if (unlikely(error))
+ if (WARN_ON_ONCE(error))
printk(KERN_ERR "kvm: vmclear fail: %p/%llx\n",
vmcs, phys_addr);
}
@@ -201,7 +201,7 @@ static inline void vmcs_load(struct vmcs *vmcs)

asm volatile (__ex("vmptrld %1") CC_SET(na)
: CC_OUT(na) (error) : "m"(phys_addr));
- if (unlikely(error))
+ if (WARN_ON_ONCE(error))
printk(KERN_ERR "kvm: vmptrld %p/%llx failed\n",
vmcs, phys_addr);
}
--
1.8.3.1