aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/migrate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index 7dbcb22316d2..0bc640fd68fa 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1044,7 +1044,7 @@ static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages,
1044 int err; 1044 int err;
1045 1045
1046 for (i = 0; i < nr_pages; i += chunk_nr) { 1046 for (i = 0; i < nr_pages; i += chunk_nr) {
1047 if (chunk_nr + i > nr_pages) 1047 if (chunk_nr > nr_pages - i)
1048 chunk_nr = nr_pages - i; 1048 chunk_nr = nr_pages - i;
1049 1049
1050 err = copy_from_user(chunk_pages, &pages[i], 1050 err = copy_from_user(chunk_pages, &pages[i],