diff --git a/mm/migrate.c b/mm/migrate.c index 7dbcb22316d2b2e482de278a8023c6429fe7bfaf..0bc640fd68fa64c38915d40fe20db545c1784799 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, int err; for (i = 0; i < nr_pages; i += chunk_nr) { - if (chunk_nr + i > nr_pages) + if (chunk_nr > nr_pages - i) chunk_nr = nr_pages - i; err = copy_from_user(chunk_pages, &pages[i],