mm, memory_hotplug: test_pages_in_a_zone do not pass the end of zone
[sfrench/cifs-2.6.git] / mm / memory_hotplug.c
index 91e6fef4cf9f58d8a7aba060a8476cfa5347a3e4..ecc5ee04e30168abea68a22edaa1faab104d73b2 100644 (file)
@@ -1274,6 +1274,9 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,
                                i++;
                        if (i == MAX_ORDER_NR_PAGES || pfn + i >= end_pfn)
                                continue;
+                       /* Check if we got outside of the zone */
+                       if (zone && !zone_spans_pfn(zone, pfn + i))
+                               return 0;
                        page = pfn_to_page(pfn + i);
                        if (zone && page_zone(page) != zone)
                                return 0;