summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLianbo Jiang <lijiang@redhat.com>2020-02-24 14:36:55 +0800
committerSimon Horman <horms@verge.net.au>2020-04-01 14:42:35 +0200
commit618799e90566e22554584644e496ff95f425ac48 (patch)
tree8410c5ca2eb3a405e2983649fdb31b812110ffa9
parent9cf721279f6cb0dec09c8752e471f15fb662406b (diff)
downloadkexec-tools-618799e90566e22554584644e496ff95f425ac48.tar.gz
kexec: support parsing the string "Reserved" to get the correct e820 reserved region
When loading kernel and initramfs for kexec, kexec-tools could get the e820 reserved region from "/proc/iomem" in order to rebuild the e820 ranges for kexec kernel, but there may be the string "Reserved" in the "/proc/iomem", which caused the failure of parsing. For example: #cat /proc/iomem|grep -i reserved 00000000-00000fff : Reserved 7f338000-7f34dfff : Reserved 7f3cd000-8fffffff : Reserved f17f0000-f17f1fff : Reserved fe000000-ffffffff : Reserved Currently, kexec-tools can not handle the above case because the memcmp() is case sensitive when comparing the string. So, let's fix this corner and make sure that the string "reserved" and "Reserved" in the "/proc/iomem" are both parsed appropriately. Signed-off-by: Lianbo Jiang <lijiang@redhat.com> Acked-by: Bhupesh Sharma <bhsharma@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/i386/kexec-x86-common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
index 61ea1938..9303704a 100644
--- a/kexec/arch/i386/kexec-x86-common.c
+++ b/kexec/arch/i386/kexec-x86-common.c
@@ -90,7 +90,7 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
if (memcmp(str, "System RAM\n", 11) == 0) {
type = RANGE_RAM;
}
- else if (memcmp(str, "reserved\n", 9) == 0) {
+ else if (strncasecmp(str, "reserved\n", 9) == 0) {
type = RANGE_RESERVED;
}
else if (memcmp(str, "ACPI Tables\n", 12) == 0) {