kdump: fix an error that can not parse the e820 reserved region
Subsystems (2)
PATCH 1/1 kdump: fix an error that can not parse the e820 reserved region
When kexec-tools load the kernel and initramfs for kdump, kexec-tools will read /proc/iomem and recreate the e820 ranges for kdump kernel. But it fails to parse the e820 reserved region, because the memcmp() is case sensitive when comparing the string. In fact, it may be "Reserved" or "reserved" in the /proc/iomem, so we use the strncasecmp() instead of the memcmp() to fix it.
--- kexec/arch/i386/crashdump-x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +1 -1
@@ -287,7 +287,7 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges, type =RANGE_PRAM ; }else if (memcmp (str,"Persistent Memory\n" ,18 ) ==0 ) { type =RANGE_PMEM ; - }else if (memcmp (str,"reserved\n" ,9 ) ==0 ) { + }else if (strncasecmp (str,"reserved\n" ,9 ) ==0 ) { type =RANGE_RESERVED ; }else if (memcmp (str,"GART\n" ,5 ) ==0 ) { gart_start = start;
Signature · 7 lines
2.17.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Hi Lianbo,
Quoted 17 lines · Lianbo Jiang
When kexec-tools load the kernel and initramfs for kdump, kexec-tools will read
/proc/iomemand recreate the e820 ranges for kdump kernel. But it fails to parse the e820 reserved region, because thememcmp()is case sensitive when comparing the string. In fact, it may be "Reserved" or "reserved" in the/proc/iomem, so we use thestrncasecmp()instead of thememcmp()to fix it.Signed-off-by Lianbo Jiang <[email protected]>--- kexec/arch/i386/crashdump-x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kexec/arch/i386/crashdump-x86.c +0
-0
kexec/arch/i386/crashdump-x86.c static int get_crash_memory_ranges(struct memory_range **range, int *ranges, · line 291
Quoted 6 lines
kexec/arch/i386/crashdump-x86.c +1
-1@@ -287,7 +287,7 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges, type =RANGE_PRAM ; }else if (memcmp (str,"Persistent Memory\n" ,18 ) ==0 ) { type =RANGE_PMEM ; - }else if (memcmp (str,"reserved\n" ,9 ) ==0 ) { + }else if (strncasecmp (str,"reserved\n" ,9 ) ==0 ) { type =RANGE_RESERVED ;
It would be better to use two memcmp in two "else if" for "reserved" and "Reserved"
BTW, add one whitespace before the function arguments.
Quoted 10 lines
kexec/arch/i386/crashdump-x86.c +0
-0}else if (memcmp (str,"GART\n" ,5 ) ==0 ) { gart_start = start;Signature · 7 lines
2.17.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Thanks
Dave
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 15 lines · Dave Young
Hi Lianbo,
Quoted 12 lines · Lianbo Jiang
When kexec-tools load the kernel and initramfs for kdump, kexec-tools will read
/proc/iomemand recreate the e820 ranges for kdump kernel. But it fails to parse the e820 reserved region, because thememcmp()is case sensitive when comparing the string. In fact, it may be "Reserved" or "reserved" in the/proc/iomem, so we use thestrncasecmp()instead of thememcmp()to fix it.Signed-off-by Lianbo Jiang <[email protected]>--- kexec/arch/i386/crashdump-x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
kexec/arch/i386/crashdump-x86.c static int get_crash_memory_ranges(struct memory_range **range, int *ranges, · line 291
Quoted 11 lines
kexec/arch/i386/crashdump-x86.c +1
-1@@ -287,7 +287,7 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges, type =RANGE_PRAM ; }else if (memcmp (str,"Persistent Memory\n" ,18 ) ==0 ) { type =RANGE_PMEM ; - }else if (memcmp (str,"reserved\n" ,9 ) ==0 ) { + }else if (strncasecmp (str,"reserved\n" ,9 ) ==0 ) { type =RANGE_RESERVED ;It would be better to use two memcmp in two "else if" for "reserved" and "Reserved"
Ok, i will post v2 again later.
Thanks.
Quoted 8 lines
BTW, add one whitespace before the function arguments.
Quoted 6 lines
kexec/arch/i386/crashdump-x86.c +0
-0}else if (memcmp (str,"GART\n" ,5 ) ==0 ) { gart_start = start;Signature · 1 line
2.17.1
Quoted 8 lines
Quoted 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexecThanks
Dave
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec