summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/page_alloc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 512e3f4d4963..ca978992c898 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1465,15 +1465,19 @@ static int __init build_zonelists_node(pg_data_t *pgdat,
struct zone *zone;
BUG_ON(k > ZONE_HIGHMEM);
- for (zone = pgdat->node_zones + k; zone >= pgdat->node_zones; zone--) {
+
+ do {
+ zone = pgdat->node_zones + k;
if (populated_zone(zone)) {
#ifndef CONFIG_HIGHMEM
- BUG_ON(zone - pgdat->node_zones > ZONE_NORMAL);
+ BUG_ON(k > ZONE_NORMAL);
#endif
zonelist->zones[j++] = zone;
check_highest_zone(k);
}
- }
+ k--;
+
+ } while (k >= 0);
return j;
}