MEMDISK: fix MBR geometry extraction
authorH. Peter Anvin <hpa@linux.intel.com>
Tue, 14 Apr 2009 19:01:07 +0000 (12:01 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Tue, 14 Apr 2009 19:01:07 +0000 (12:01 -0700)
Fix the MBR geometry extraction; there was an off-by-2 error in the
MBR signature offset.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
memdisk/setup.c

index 0fee982..6507e56 100644 (file)
@@ -565,7 +565,7 @@ const struct geometry *get_disk_image_geometry(uint32_t where, uint32_t size)
              
        hd_geometry.driveno = 0x80; /* Assume hard disk */
        
-       if (*(uint16_t *)((char *)where+512) == 0xaa55)
+       if (*(uint16_t *)((char *)where+512-2) == 0xaa55)
          for ( i = 0 ; i < 4 ; i++ ) {
            if ( ptab[i].type && !(ptab[i].active & 0x7f) ) {
              s = (ptab[i].start_s & 0x3f);