From: Prarit Bhargava <prarit@redhat.com> Date: Tue, 9 Sep 2008 10:07:09 -0400 Subject: [x86_64] use strncmp for memmap=exactmap boot argument Message-id: 20080909135959.20915.73822.sendpatchset@prarit.bos.redhat.com O-Subject: [RHEL5 PATCH] BZ 450244 Followup - Fix memmap=exactmap boot argument Bugzilla: 450244 RH-Acked-by: Neil Horman <nhorman@redhat.com> RH-Acked-by: Larry Woodman <lwoodman@redhat.com> RH-Acked-by: Rik van Riel <riel@redhat.com> Don, this is a follow-up to BZ 450244. When kdumping it was noticed that some systems were producing 0-sized vmcores or /proc/vmcore had size 0. This was due to an improper usage of strcmp() in the "memmap=" option parsing code. When passing "memmap=exactmap memmap=640K@0K memmap=5228K@16384K memmap=1 25188K@22252K elfcorehdr=147440K memmap=76K#1047424K memmap=564K#1047500K" on the command line the result was user: 0000000000000000 - 0000000000093400 (usable) user: 0000000000093400 - 00000000000a0000 (reserved) user: 0000000000100000 - 000000003fee0000 (usable) user: 000000003fee0000 - 000000003fef3000 (ACPI data) user: 000000003fef3000 - 000000003ff80000 (ACPI NVS) user: 000000003ff80000 - 0000000040000000 (reserved) user: 00000000e0000000 - 00000000f0000000 (reserved) user: 00000000fec00000 - 00000000fec10000 (reserved) user: 00000000fee00000 - 00000000fee01000 (reserved) user: 00000000ff000000 - 0000000100000000 (reserved) After the patch the result is correct user-defined physical RAM map: user: 0000000000000000 - 00000000000a0000 (usable) user: 0000000001000000 - 000000000151b000 (usable) user: 00000000015bb000 - 0000000008ffc000 (usable) user: 000000003fee0000 - 000000003ff80000 (ACPI data) This patch was tested on two systems. On one system kdump was succeeding despite this error because the newly created map was close enough to the one that kdump wanted. On the second machine, kdump was failing 100% of the time. With this patch both systems are returning the correct RAM map, and kdump is working. diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c index 54a777d..55a9a53 100644 --- a/arch/x86_64/kernel/e820.c +++ b/arch/x86_64/kernel/e820.c @@ -665,7 +665,7 @@ void __init parse_memmapopt(char *p, char **from) char *oldp; unsigned long long start_at, mem_size; - if (!strcmp(p, "exactmap")) { + if (!strncmp(p, "exactmap", 8)) { #ifdef CONFIG_CRASH_DUMP /* * If we are doing a crash dump, we still need to know