Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3973

kernel-2.6.18-194.11.1.el5.src.rpm

From: Prarit Bhargava <prarit@redhat.com>
Date: Mon, 29 Sep 2008 09:44:46 -0400
Subject: [x86] memmap=X$Y does not yield new map
Message-id: 20080929133356.22813.81929.sendpatchset@prarit.bos.redhat.com
O-Subject: [RHEL5 PATCH] memmap=X$Y does not yield new map
Bugzilla: 464500
RH-Acked-by: Neil Horman <nhorman@redhat.com>

Backport 2.6.27-rc7 behavior for memmap kernel options into i386 arch.  x86_64
already mimics upstream.

Customer reports that specifying memmap=X$Y as boot parameter does not
generate a user-defined physical map.

Upstream has a panic() in place of the printk() below.  I'm using printk()
to avoid crashing any existing systems even though they are configured
in a potentially harmful way.

Resolves BZ 464500.

diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 6b65d8f..d7f056d 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -799,6 +799,7 @@ static void __init parse_cmdline_early (char ** cmdline_p)
 				unsigned long long start_at, mem_size;
  
 				mem_size = memparse(from+7, &from);
+				userdef=1;
 				if (*from == '@') {
 					start_at = memparse(from+1, &from);
 					add_memory_region(start_at, mem_size, E820_RAM);
@@ -808,10 +809,8 @@ static void __init parse_cmdline_early (char ** cmdline_p)
 				} else if (*from == '$') {
 					start_at = memparse(from+1, &from);
 					add_memory_region(start_at, mem_size, E820_RESERVED);
-				} else {
+				} else
 					limit_regions(mem_size);
-					userdef=1;
-				}
 			}
 		}
 
@@ -957,6 +956,10 @@ static void __init parse_cmdline_early (char ** cmdline_p)
 	*to = '\0';
 	*cmdline_p = command_line;
 	if (userdef) {
+		char nr = e820.nr_map;
+		if (sanitize_e820_map(e820.map, &nr) < 0)
+			printk("Invalid user supplied memory map\n");
+		e820.nr_map = nr;
 		printk(KERN_INFO "user-defined physical RAM map:\n");
 		print_memory_map("user");
 	}