mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
fs: fat_write: fix the incorrect last cluster checking
In fat_write.c, the last clust condition check is incorrect: if ((curclust >= 0xffffff8) || (curclust >= 0xfff8)) { ... ... } For example, in FAT32 if curclust is 0x11000. It is a valid clust. But on above condition check, it will be think as a last clust. So the correct last clust check should be: in fat32, curclust >= 0xffffff8 in fat16, curclust >= 0xfff8 in fat12, curclust >= 0xff8 This patch correct the last clust check. Signed-off-by: Josh Wu <josh.wu@atmel.com>
This commit is contained in:
@ -84,6 +84,9 @@
|
||||
#define START(dent) (FAT2CPU16((dent)->start) \
|
||||
+ (mydata->fatsize != 32 ? 0 : \
|
||||
(FAT2CPU16((dent)->starthi) << 16)))
|
||||
#define IS_LAST_CLUST(x, fatsize) ((x) >= ((fatsize) != 32 ? \
|
||||
((fatsize) != 16 ? 0xff8 : 0xfff8) : \
|
||||
0xffffff8))
|
||||
#define CHECK_CLUST(x, fatsize) ((x) <= 1 || \
|
||||
(x) >= ((fatsize) != 32 ? \
|
||||
((fatsize) != 16 ? 0xff0 : 0xfff0) : \
|
||||
|
Reference in New Issue
Block a user