From: Naoya Horiguchi Date: Thu, 22 May 2014 00:42:39 +0000 (+1000) Subject: mm/pagewalk.c: fix end address calculation in walk_page_range() X-Git-Tag: next-20140530~2^2~400 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=212ea39814ce0f5f796e7219ca18caa39fdf548e;p=karo-tx-linux.git 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 --- 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)