From 9c08378bfbf14696495ca8e3507d7f46daba8a3f Mon Sep 17 00:00:00 2001 From: Sven Hoexter Date: Sun, 19 Apr 2015 13:40:33 +0200 Subject: [PATCH] Imported Upstream version 1.1.1 --- ChangeLog | 4 ++++ libexfat/version.h | 2 +- mkfs/cbm.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ccfdde8..a741eae 100644 --- 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+. diff --git a/libexfat/version.h b/libexfat/version.h index 20c1147..adabaad 100644 --- a/libexfat/version.h +++ b/libexfat/version.h @@ -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 */ diff --git a/mkfs/cbm.c b/mkfs/cbm.c index e3e9dd2..e30928c 100644 --- a/mkfs/cbm.c +++ b/mkfs/cbm.c @@ -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); -- 2.39.5