From: Liam R. Howlett <Liam.Howlett@Oracle.com>
Date: Thu, 8 Apr 2021 20:06:36 +0000 (-0400)
Subject: xen: Use vma_lookup() in privcmd_ioctl_mmap()
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f08546e04e9216e9e5b438d13418e15a2e93e767;p=users%2Fjedix%2Flinux-maple.git

xen: Use vma_lookup() in privcmd_ioctl_mmap()

vma_lookup() walks the VMA tree for a specific value, find_vma() will
search the tree after walking to a specific value.  It is more efficient
to only walk to the requested value as this case requires the address to
equal the vm_start.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---

diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 720a7b7abd46..5f903ae9af7e 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -282,7 +282,7 @@ static long privcmd_ioctl_mmap(struct file *file, void __user *udata)
 						     struct page, lru);
 		struct privcmd_mmap_entry *msg = page_address(page);
 
-		vma = find_vma(mm, msg->va);
+		vma = vma_lookup(mm, msg->va);
 		rc = -EINVAL;
 
 		if (!vma || (msg->va != vma->vm_start) || vma->vm_private_data)