aboutsummaryrefslogtreecommitdiff
path: root/fs/fat/fat.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fat/fat.c')
-rw-r--r--fs/fat/fat.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 4bc3030ab88..e0c076763f5 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -571,6 +571,17 @@ static int get_fs_info(fsdata *mydata)
mydata->sect_size, cur_part_info.blksz);
return -1;
}
+ if (mydata->clust_size == 0) {
+ printf("Error: FAT cluster size not set\n");
+ return -1;
+ }
+ if ((unsigned int)mydata->clust_size * mydata->sect_size >
+ MAX_CLUSTSIZE) {
+ printf("Error: FAT cluster size too big (cs=%u, max=%u)\n",
+ (unsigned int)mydata->clust_size * mydata->sect_size,
+ MAX_CLUSTSIZE);
+ return -1;
+ }
if (mydata->fatsize == 32) {
mydata->data_begin = mydata->rootdir_sect -