R0.14b patch 1

March 5, 2022

f_mkfs function creates broken exFAT volume when the size of volume is >= 2^32 sectors (2 TiB in 512 bytes/sector).
This commit is contained in:
Christopher Williams
2022-05-09 17:35:03 -07:00
parent 074e3603ef
commit 99415e7a91
+1 -1
View File
@@ -5957,7 +5957,7 @@ FRESULT f_mkfs (
sz_fat = (DWORD)((sz_vol / sz_au + 2) * 4 + ss - 1) / ss; /* Number of FAT sectors */
b_data = (b_fat + sz_fat + sz_blk - 1) & ~((LBA_t)sz_blk - 1); /* Align data area to the erase block boundary */
if (b_data - b_vol >= sz_vol / 2) LEAVE_MKFS(FR_MKFS_ABORTED); /* Too small volume? */
n_clst = (DWORD)(sz_vol - (b_data - b_vol)) / sz_au; /* Number of clusters */
n_clst = (DWORD)((sz_vol - (b_data - b_vol)) / sz_au); /* Number of clusters */
if (n_clst <16) LEAVE_MKFS(FR_MKFS_ABORTED); /* Too few clusters? */
if (n_clst > MAX_EXFAT) LEAVE_MKFS(FR_MKFS_ABORTED); /* Too many clusters? */