]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xen: use vma_lookup() in privcmd_ioctl_mmap()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 6 Sep 2022 19:48:49 +0000 (19:48 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 27 Sep 2022 02:46:16 +0000 (19:46 -0700)
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 since privcmd_ioctl_mmap() will exit
the loop if vm_start != msg->va.

Link: https://lkml.kernel.org/r/20220906194824.2110408-20-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Tested-by: Yu Zhao <yuzhao@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/xen/privcmd.c

index e88e8f6f0a334ade815c95b423f380b7ff3d057a..fae50a24630bd0e517c5512f327fd9d55d244221 100644 (file)
@@ -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)