bstroesser at ts.fujitsu.com
2010-Mar-23 16:56 UTC
[syslinux] [PATCH] memdisk: MBR not recognized correctly
From: Bodo Stroesser <bstroesser at ts.fujitsu.com> This fixes a small inaccuracy in memdisk: get_disk_image_geometry() does not use MBR data to detect disk geometry, since it checks MBR signature at wrong offset. This normally does not cause problems, because memdisk guesses a reasonable value, if no MBR is found. Signed-off-by: Bodo Stroesser <bstroesser at ts.fujitsu.com> --- --- syslinux-3.85/memdisk/setup.c.orig 2010-02-17 05:12:57.000000000 +0100 +++ syslinux-3.85/memdisk/setup.c 2010-03-23 16:23:35.000000000 +0100 @@ -648,7 +648,7 @@ static const struct geometry *get_disk_i if (!hd_geometry.driveno) hd_geometry.driveno = 0x80; - if (*(uint16_t *) ((char *)where + 512 - 2) == 0xaa55) { + if (*(uint16_t *) ((char *)where + hd_geometry.offset + 512 - 2) == 0xaa55) { for (i = 0; i < 4; i++) { if (ptab[i].type && !(ptab[i].active & 0x7f)) { s = (ptab[i].start_s & 0x3f);
Gert Hulselmans
2010-Mar-31 07:55 UTC
[syslinux] [PATCH] memdisk: MBR not recognized correctly
bstroesser at ts.fujitsu.com wrote:> From: Bodo Stroesser <bstroesser at ts.fujitsu.com> > > This fixes a small inaccuracy in memdisk: > > get_disk_image_geometry() does not use MBR data to detect disk > geometry, since it checks MBR signature at wrong offset. > > This normally does not cause problems, because memdisk guesses a > reasonable value, if no MBR is found. > > Signed-off-by: Bodo Stroesser <bstroesser at ts.fujitsu.com> > --- > > --- syslinux-3.85/memdisk/setup.c.orig 2010-02-17 05:12:57.000000000 +0100 > +++ syslinux-3.85/memdisk/setup.c 2010-03-23 16:23:35.000000000 +0100 > @@ -648,7 +648,7 @@ static const struct geometry *get_disk_i > if (!hd_geometry.driveno) > hd_geometry.driveno = 0x80; > > - if (*(uint16_t *) ((char *)where + 512 - 2) == 0xaa55) { > + if (*(uint16_t *) ((char *)where + hd_geometry.offset + 512 - 2) => 0xaa55) { > for (i = 0; i < 4; i++) { > if (ptab[i].type && !(ptab[i].active & 0x7f)) { > s = (ptab[i].start_s & 0x3f);It is fixed in syslinux-3.86-pre2 (and higher). Thanks for the patch. - Gert Hulselmans