load_linux: validate sanity of 'initrd_addr_max'
authorMatt Fleming <matt.fleming@intel.com>
Mon, 1 Jul 2013 15:55:20 +0000 (16:55 +0100)
committerMatt Fleming <matt.fleming@intel.com>
Mon, 1 Jul 2013 16:02:04 +0000 (17:02 +0100)
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@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
com32/lib/syslinux/load_linux.c

index af3751e..7638e6f 100644 (file)
@@ -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)