When we try to walk over inside a vma, walk_page_range() tries to walk
until vma->vm_end even if a given end is before that point.
So this patch takes the smaller one as an end address.
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
next = vma->vm_start;
} else { /* inside the found vma */
walk->vma = vma;
- next = vma->vm_end;
- err = walk_page_test(start, end, walk);
+ next = min_t(unsigned long, end, vma->vm_end);
+
+ err = walk_page_test(start, next, walk);
if (skip_lower_level_walking(walk))
continue;
if (err)