summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2019-09-13 13:54:08 +0200
committerJaehoon Chung <jh80.chung@samsung.com>2020-10-20 15:13:47 +0900
commit13dd35c596d2959b85eeea90533ae26e197b18e2 (patch)
treed134e0e76cb74a14558883b45a44be0c494be395 /fs
parent59687d19cb756cfebae147dfd0d06e70faa59416 (diff)
downloadu-boot-13dd35c596d2959b85eeea90533ae26e197b18e2.tar.gz
u-boot-13dd35c596d2959b85eeea90533ae26e197b18e2.tar.bz2
u-boot-13dd35c596d2959b85eeea90533ae26e197b18e2.zip
fat: write: fix broken write to fragmented files
The code for handing file overwrite incorrectly assumed that the file on disk is always contiguous. This resulted in corrupting disk structure every time when write to existing fragmented file happened. Fix this by adding proper check for cluster discontinuity and adjust chunk size on each partial write. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> Reviewed-by: Lukasz Majewski <lukma@denx.de> Change-Id: Ic32563cd9e1fc34efd153d94ecd34de4de80e8b2 Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/fat/fat_write.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index a2682b5f46..d7fdc56c82 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -832,7 +832,6 @@ set_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, __u8 *buffer,
offset = pos - cur_pos;
wsize = min_t(unsigned long long, actsize, filesize - cur_pos);
wsize -= offset;
-
if (get_set_cluster(mydata, curclust, offset,
buffer, wsize, &actsize)) {
printf("Error get-and-setting cluster\n");