memdisk: MBR not recognized correctly
authorBodo Stroesser <bstroesser at ts.fujitsu.com>
Tue, 23 Mar 2010 16:56:29 +0000 (17:56 +0100)
committerH. Peter Anvin <hpa@linux.intel.com>
Tue, 30 Mar 2010 22:19:41 +0000 (15:19 -0700)
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>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
memdisk/setup.c

index bcb5d04..cec25ad 100644 (file)
@@ -648,7 +648,7 @@ static const struct geometry *get_disk_image_geometry(uint32_t where,
                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);