diff options
author | Wu, Josh <Josh.wu@atmel.com> | 2014-05-08 16:14:06 +0800 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-05-12 16:31:50 -0400 |
commit | 2e98f70882f8c1a09b662137884c1435a97c9a1c (patch) | |
tree | 43b50a0850bd03e6e051477f42cab39468d9add4 /fs | |
parent | 06118973ede291df8617c4089972cbf888bdc96b (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fat/fat_write.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index cef138ec965..90d6ab63bf7 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -882,7 +882,7 @@ static dir_entry *find_directory_entry(fsdata *mydata, int startsect, } curclust = get_fatent_value(mydata, dir_curclust); - if ((curclust >= 0xffffff8) || (curclust >= 0xfff8)) { + if (IS_LAST_CLUST(curclust, mydata->fatsize)) { empty_dentptr = dentptr; return NULL; } |