]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/i386/kernel/setup.c
[PATCH] fixup bogus e820 entry with mem=
[linux-2.6-omap-h63xx.git] / arch / i386 / kernel / setup.c
index 9b8c8a19824de64c9a308177e11f55df3974099c..b48ac635f3c19cb79d11086835b538cc0b1dcf00 100644 (file)
@@ -389,14 +389,24 @@ static void __init limit_regions(unsigned long long size)
                }
        }
        for (i = 0; i < e820.nr_map; i++) {
-               if (e820.map[i].type == E820_RAM) {
-                       current_addr = e820.map[i].addr + e820.map[i].size;
-                       if (current_addr >= size) {
-                               e820.map[i].size -= current_addr-size;
-                               e820.nr_map = i + 1;
-                               return;
-                       }
+               current_addr = e820.map[i].addr + e820.map[i].size;
+               if (current_addr < size)
+                       continue;
+
+               if (e820.map[i].type != E820_RAM)
+                       continue;
+
+               if (e820.map[i].addr >= size) {
+                       /*
+                        * This region starts past the end of the
+                        * requested size, skip it completely.
+                        */
+                       e820.nr_map = i;
+               } else {
+                       e820.nr_map = i + 1;
+                       e820.map[i].size -= current_addr - size;
                }
+               return;
        }
 }