vma_lookup() will only return the vma which contains the address and
will not return the next vma. This allows the code to easier to
understand.
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mmap_read_lock(mm);
for (addr = start; addr < end; addr = next) {
- vma = find_vma(mm, addr);
- if (!vma || addr < vma->vm_start ||
- !(vma->vm_flags & VM_READ)) {
+ vma = vma_lookup(mm, addr);
+ if (!vma || !(vma->vm_flags & VM_READ)) {
ret = -EINVAL;
goto out;
}