Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions libexfat/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,15 @@ int exfat_mount(struct exfat* ef, const char* spec, const char* options)
exfat_get_size(ef->dev));
}
if ((off_t) le32_to_cpu(ef->sb->cluster_count) * CLUSTER_SIZE(*ef->sb) >
exfat_get_size(ef->dev))
(le64_to_cpu(ef->sb->sector_count) - le32_to_cpu(ef->sb->cluster_sector_start))
* SECTOR_SIZE(*ef->sb))
{
exfat_error("file system in clusters is larger than device: "
"%u * %d > %"PRIu64,
exfat_error("file system in clusters is larger than file system in sectors: "
"%u * %d > (%"PRIu64" - %d) * %d",
le32_to_cpu(ef->sb->cluster_count), CLUSTER_SIZE(*ef->sb),
exfat_get_size(ef->dev));
le64_to_cpu(ef->sb->sector_count),
le32_to_cpu(ef->sb->cluster_sector_start),
SECTOR_SIZE(*ef->sb));
exfat_free(ef);
return -EIO;
}
Expand Down
3 changes: 1 addition & 2 deletions mkfs/vbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ static void init_sb(struct exfat_super_block* sb)
sb->cluster_sector_start = cpu_to_le32(
get_position(&cbm) / get_sector_size());
sb->cluster_count = cpu_to_le32(clusters_max -
((le32_to_cpu(sb->fat_sector_start) +
le32_to_cpu(sb->fat_sector_count)) >> get_spc_bits()));
(le32_to_cpu(sb->cluster_sector_start) >> get_spc_bits()));
sb->rootdir_cluster = cpu_to_le32(
(get_position(&rootdir) - get_position(&cbm)) / get_cluster_size()
+ EXFAT_FIRST_DATA_CLUSTER);
Expand Down