[PATCH RFC 1/8] KVM: SVM: fix: calculate end instead of passing size

From: Jarkko Sakkinen
Date: Thu Jan 26 2023 - 21:53:02 EST


From: Tom Dohrmann <erbse.13@xxxxxx>

The third parameter of `kvm_vm_do_hva_range_op` doesn't take the size
of the range, but the end of the range.

Signed-off-by: Tom Dohrmann <erbse.13@xxxxxx>
Link: https://lore.kernel.org/lkml/Y6Sgwp%2FBofzCUrQe@notebook/
Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxxx>
---
arch/x86/kvm/svm/sev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 855f5e702240..d3468d1533bd 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -500,7 +500,7 @@ static int sev_get_memfile_pfn(struct kvm *kvm, unsigned long addr,
unsigned long size, unsigned long npages,
struct page **pages)
{
- return kvm_vm_do_hva_range_op(kvm, addr, size,
+ return kvm_vm_do_hva_range_op(kvm, addr, addr + size,
sev_get_memfile_pfn_handler, pages);
}

--
2.38.1