patch-2.3.34 linux/arch/i386/kernel/setup.c

Next file: linux/arch/i386/kernel/smp.c
Previous file: linux/arch/i386/kernel/process.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.33/linux/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c
@@ -592,13 +592,16 @@
 	 */
 	max_pfn = 0;
 	for (i = 0; i < e820.nr_map; i++) {
-		unsigned long curr_pfn;
+		unsigned long start, end;
 		/* RAM? */
 		if (e820.map[i].type != E820_RAM)
 			continue;
-		curr_pfn = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
-		if (curr_pfn > max_pfn)
-			max_pfn = curr_pfn;
+		start = PFN_UP(e820.map[i].addr);
+		end = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
+		if (start >= end)
+			continue;
+		if (end > max_pfn)
+			max_pfn = end;
 	}
 
 	/*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)