]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm/pagewalk.c: fix end address calculation in walk_page_range()
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Thu, 22 May 2014 00:42:39 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:42:39 +0000 (10:42 +1000)
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>
mm/pagewalk.c

index 4770558feea810ccad8c3512cbf3661061615c1f..9f371ff6769790d7726b6c6c99331e970bbbb6bc 100644 (file)
@@ -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)