From 212ea39814ce0f5f796e7219ca18caa39fdf548e Mon Sep 17 00:00:00 2001 From: Naoya Horiguchi Date: Thu, 22 May 2014 10:42:39 +1000 Subject: [PATCH] mm/pagewalk.c: fix end address calculation in walk_page_range() 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 Cc: Sasha Levin Signed-off-by: Andrew Morton --- mm/pagewalk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 4770558feea8..9f371ff67697 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -321,8 +321,9 @@ int walk_page_range(unsigned long start, unsigned long end, 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) -- 2.39.5