]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: Add vma_lookup()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 1 Mar 2021 19:01:06 +0000 (14:01 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 6 May 2021 17:25:45 +0000 (13:25 -0400)
commit80f4c6f900316631be83b332e29fb458ad9de3eb
treecd2a2d82f0c058dd1ae99a0ef8a22673bc61ad41
parent23c498428c14e509d23d4b3922bf0c879ff16f54
mm: Add vma_lookup()

Many places in the kernel use find_vma() to get a vma and then check the
start address of the vma to ensure the next vma was not returned.

Other places use the find_vma_intersection() call with add, addr + 1 as
the range; looking for just the vma at a specific address.

The third use of find_vma() is by developers who do not know that the
function starts searching at the provided address upwards for the next
vma.  This results in a bug that is often overlooked for a long time.

Adding the new vma_lookup() function will allow for cleaner code by
removing the find_vma() calls which check limits, making
find_vma_intersection() calls of a single address to be shorter, and
potentially reduce the incorrect uses of find_vma().

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
include/linux/mm.h