Merge tag 'upstream/1.1.1'
authorSven Hoexter <sven@stormbind.net>
Sun, 19 Apr 2015 11:40:35 +0000 (13:40 +0200)
committerSven Hoexter <sven@stormbind.net>
Sun, 19 Apr 2015 11:40:35 +0000 (13:40 +0200)
Upstream version 1.1.1

ChangeLog
libexfat/version.h
mkfs/cbm.c

index ccfdde8..a741eae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+1.1.1 (2014-11-15)
+
+* Fixed mkfs crash on some sectors-per-cluster (-s option) values.
+
 1.1.0 (2014-07-08)
 
 * Relicensed the project from GPLv3+ to GPLv2+.
index 20c1147..adabaad 100644 (file)
@@ -25,6 +25,6 @@
 
 #define EXFAT_VERSION_MAJOR 1
 #define EXFAT_VERSION_MINOR 1
-#define EXFAT_VERSION_PATCH 0
+#define EXFAT_VERSION_PATCH 1
 
 #endif /* ifndef VERSION_H_INCLUDED */
index e3e9dd2..e30928c 100644 (file)
@@ -45,7 +45,7 @@ static int cbm_write(struct exfat_dev* dev)
                        DIV_ROUND_UP(cbm.get_size(), get_cluster_size()) +
                        DIV_ROUND_UP(uct.get_size(), get_cluster_size()) +
                        DIV_ROUND_UP(rootdir.get_size(), get_cluster_size());
-       size_t bitmap_size = DIV_ROUND_UP(allocated_clusters, CHAR_BIT);
+       size_t bitmap_size = ROUND_UP(allocated_clusters, CHAR_BIT);
        bitmap_t* bitmap = malloc(BMAP_SIZE(bitmap_size));
        size_t i;
 
@@ -57,13 +57,14 @@ static int cbm_write(struct exfat_dev* dev)
        }
        memset(bitmap, 0, BMAP_SIZE(bitmap_size));
 
-       for (i = 0; i < bitmap_size * CHAR_BIT; i++)
+       for (i = 0; i < bitmap_size; i++)
                if (i < allocated_clusters)
                        BMAP_SET(bitmap, i);
-       if (exfat_write(dev, bitmap, bitmap_size) < 0)
+       if (exfat_write(dev, bitmap, bitmap_size / CHAR_BIT) < 0)
        {
                free(bitmap);
-               exfat_error("failed to write bitmap of %zu bytes", bitmap_size);
+               exfat_error("failed to write bitmap of %zu bytes",
+                               bitmap_size / CHAR_BIT);
                return 1;
        }
        free(bitmap);