mtools: include the size of the ADV in the mappable range
authorH. Peter Anvin <hpa@linux.intel.com>
Fri, 25 Jun 2010 22:23:42 +0000 (15:23 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Fri, 25 Jun 2010 22:23:42 +0000 (15:23 -0700)
We need to include the size of the ADV in the range of data that needs
to be mapped.

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

index ade8440..f5b89c9 100644 (file)
@@ -261,7 +261,8 @@ int main(int argc, char *argv[])
     /*
      * Now, use libfat to create a block map
      */
-    ldlinux_sectors = (syslinux_ldlinux_len + SECTOR_SIZE - 1) >> SECTOR_SHIFT;
+    ldlinux_sectors = (syslinux_ldlinux_len + 2 * ADV_SIZE
+                      + SECTOR_SIZE - 1) >> SECTOR_SHIFT;
     sectors = calloc(ldlinux_sectors, sizeof *sectors);
     fs = libfat_open(libfat_xpread, dev_fd);
     ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);