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@xxxxxxxxxx> Cc: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> Fixes: ff5a983cbb3746d371de2cc95ea7dcfd982b4084 Reported-by: kernel test robot <lkp@xxxxxxxxx> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx> --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.26.2