[syslinux:elflink] load_linux: validate sanity of ' initrd_addr_max'

syslinux-bot for Matt Fleming matt.fleming at intel.com
Mon Jul 1 09:06:06 PDT 2013


Commit-ID:  9d4ab9d6ae3149465368e19334bf8f162cc36051
Gitweb:     http://www.syslinux.org/commit/9d4ab9d6ae3149465368e19334bf8f162cc36051
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Mon, 1 Jul 2013 16:55:20 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Mon, 1 Jul 2013 17:02:04 +0100

load_linux: validate sanity of 'initrd_addr_max'

Some kernel headers have bogus 'initrd_addr_max' fields. This field
should never be zero. Set it to the old upper limit if unspecified.
Failure to set a non-zero value for the field results in a bogus
'memlimit' value, thereby unnecessarily reserving part of the memmap.

Cc: H. Peter Anvin <hpa at zytor.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/lib/syslinux/load_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/syslinux/load_linux.c
index af3751e..7638e6f 100644
--- a/com32/lib/syslinux/load_linux.c
+++ b/com32/lib/syslinux/load_linux.c
@@ -254,7 +254,7 @@ int syslinux_boot_linux(void *kernel_buf, size_t kernel_size,
     if (!hdr.setup_sects)
 	hdr.setup_sects = 4;
 
-    if (hdr.version < 0x0203)
+    if (hdr.version < 0x0203 || !hdr.initrd_addr_max)
 	hdr.initrd_addr_max = 0x37ffffff;
 
     if (!memlimit && memlimit - 1 > hdr.initrd_addr_max)


More information about the Syslinux-commits mailing list