David Woodhouse <[email protected]> writes: > From: David Woodhouse <[email protected]> > > kvm_host_page_size() uses find_vma() to determine the host page size > backing a guest page. find_vma() returns the next VMA when the address > falls in an unmapped hole, which means an unmapped address inherits the > page size of a completely unrelated VMA at a higher address. This is > never a meaningful result. > > Replace find_vma() with vma_lookup() so that a hole address returns > NULL, causing the function to return PAGE_SIZE (the safe default) > rather than an unrelated VMA's page size. >
That's exactly right. > This is currently only cosmetic, as the only caller is in PPC book3s > support (kvmppc_xive_native_set_queue_config()) and subsequently returns > failure if !gfn_to_page() anyway. > Yup. The change make sense to me. Feel free to add: Reviewed-by: Ritesh Harjani (IBM) <[email protected]> > Signed-off-by: David Woodhouse <[email protected]> > --- > virt/kvm/kvm_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 89489996fbc1..d33761123459 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -2693,7 +2693,7 @@ unsigned long kvm_host_page_size(struct kvm_vcpu *vcpu, > gfn_t gfn) > return PAGE_SIZE; > > mmap_read_lock(current->mm); > - vma = find_vma(current->mm, addr); > + vma = vma_lookup(current->mm, addr); > if (!vma) > goto out; > > -- > 2.43.0
