diff mbox series

KVM: X86: Fix __x86_set_memory_region() sparse warning

Message ID 20210301133438.396869-1-peterx@redhat.com (mailing list archive)
State New, archived
Headers show
Series KVM: X86: Fix __x86_set_memory_region() sparse warning | expand

Commit Message

Peter Xu March 1, 2021, 1:34 p.m. UTC
Force ERR_PTR_USR() cast even if the return value is meaningless when deleting
slots, just to pass the sparse check.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Fixes: ff5a983cbb3746d371de2cc95ea7dcfd982b4084
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1b404e4d7dd8..44de71995a34 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10502,7 +10502,7 @@  void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa,
 			return (void __user *)hva;
 	} else {
 		if (!slot || !slot->npages)
-			return 0;
+			return ERR_PTR_USR(0);
 		old_npages = slot->npages;
 		hva = slot->userspace_addr;