summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2011-02-25 23:44:25 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-26 00:07:37 +0100
commit29723fccc837d20039078f7a571e8d457eb0d6c6 (patch)
treef11e37b20388eb12f04ae8718b247e931ce99379 /mm
parentdrivers/rtc/rtc-ds3232.c: fix time range difference between linux and RTC chip (diff)
downloadlinux-29723fccc837d20039078f7a571e8d457eb0d6c6.tar.xz
linux-29723fccc837d20039078f7a571e8d457eb0d6c6.zip
mm: fix dubious code in __count_immobile_pages()
When pfn_valid_within() failed 'iter' was incremented twice. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a873e61e312e..cdef1d4b4e47 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5376,10 +5376,9 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count)
for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) {
unsigned long check = pfn + iter;
- if (!pfn_valid_within(check)) {
- iter++;
+ if (!pfn_valid_within(check))
continue;
- }
+
page = pfn_to_page(check);
if (!page_count(page)) {
if (PageBuddy(page))