diff options
-rw-r--r-- | kernel/resource.c | 3 | ||||
-rw-r--r-- | mm/memory_hotplug.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index 63e879379dbd..46286434af80 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -244,6 +244,7 @@ int find_next_system_ram(struct resource *res) | |||
244 | 244 | ||
245 | start = res->start; | 245 | start = res->start; |
246 | end = res->end; | 246 | end = res->end; |
247 | BUG_ON(start >= end); | ||
247 | 248 | ||
248 | read_lock(&resource_lock); | 249 | read_lock(&resource_lock); |
249 | for (p = iomem_resource.child; p ; p = p->sibling) { | 250 | for (p = iomem_resource.child; p ; p = p->sibling) { |
@@ -254,7 +255,7 @@ int find_next_system_ram(struct resource *res) | |||
254 | p = NULL; | 255 | p = NULL; |
255 | break; | 256 | break; |
256 | } | 257 | } |
257 | if (p->start >= start) | 258 | if ((p->end >= start) && (p->start < end)) |
258 | break; | 259 | break; |
259 | } | 260 | } |
260 | read_unlock(&resource_lock); | 261 | read_unlock(&resource_lock); |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 7d25cc12235f..26f1840879d6 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -163,7 +163,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) | |||
163 | res.flags = IORESOURCE_MEM; /* we just need system ram */ | 163 | res.flags = IORESOURCE_MEM; /* we just need system ram */ |
164 | section_end = res.end; | 164 | section_end = res.end; |
165 | 165 | ||
166 | while (find_next_system_ram(&res) >= 0) { | 166 | while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) { |
167 | start_pfn = (unsigned long)(res.start >> PAGE_SHIFT); | 167 | start_pfn = (unsigned long)(res.start >> PAGE_SHIFT); |
168 | nr_pages = (unsigned long) | 168 | nr_pages = (unsigned long) |
169 | ((res.end + 1 - res.start) >> PAGE_SHIFT); | 169 | ((res.end + 1 - res.start) >> PAGE_SHIFT); |