[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210301133438.396869-1-peterx@redhat.com>
Date: Mon, 1 Mar 2021 08:34:38 -0500
From: Peter Xu <peterx@...hat.com>
To: kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: peterx@...hat.com, Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
kernel test robot <lkp@...el.com>
Subject: [PATCH] KVM: X86: Fix __x86_set_memory_region() sparse warning
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@...hat.com>
Cc: Sean Christopherson <sean.j.christopherson@...el.com>
Fixes: ff5a983cbb3746d371de2cc95ea7dcfd982b4084
Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: Peter Xu <peterx@...hat.com>
---
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
Powered by blists - more mailing lists