+ if (ef->sb->version.major != 1 || ef->sb->version.minor != 0)
+ {
+ exfat_error("unsupported exFAT version: %hhu.%hhu",
+ ef->sb->version.major, ef->sb->version.minor);
+ exfat_free(ef);
+ return -EIO;
+ }
+ if (ef->sb->fat_count != 1)
+ {
+ exfat_error("unsupported FAT count: %hhu", ef->sb->fat_count);
+ exfat_free(ef);
+ return -EIO;
+ }
+ if (le64_to_cpu(ef->sb->sector_count) * SECTOR_SIZE(*ef->sb) >
+ exfat_get_size(ef->dev))
+ {
+ /* this can cause I/O errors later but we don't fail mounting to let
+ user rescue data */
+ exfat_warn("file system in sectors is larger than device: "
+ "%"PRIu64" * %d > %"PRIu64,
+ le64_to_cpu(ef->sb->sector_count), SECTOR_SIZE(*ef->sb),
+ exfat_get_size(ef->dev));
+ }
+ if ((off_t) le32_to_cpu(ef->sb->cluster_count) * CLUSTER_SIZE(*ef->sb) >
+ exfat_get_size(ef->dev))
+ {
+ exfat_error("file system in clusters is larger than device: "
+ "%u * %d > %"PRIu64,
+ le32_to_cpu(ef->sb->cluster_count), CLUSTER_SIZE(*ef->sb),
+ exfat_get_size(ef->dev));
+ exfat_free(ef);
+ return -EIO;
+ }