u-boot-brain/fs/fat
Reno Farnesi 76216211f8 fs: fat: fix fatwrite overflow calculation
The overflow calculation was incorrect. Adding the start block of the
partition is not needed because the sectors are already relative to the
beginning of the partition. If you attempted to write a file smaller
than cur_part_info.start blocks on a full partition the old calculation
fails to catch the overflow. This would cause an infinite loop in the
determine_fatent function.

Old, incorrect calculation:

ending sector of new file = start sector + file size (in sectors)
last sector = partition start + total sectors on the partition

Adding the partition start block number is not needed because sectors
are already relative to the start of the partition.

New calculation:

ending sector of new file = start sector + file size (in sectors)
last sector = total sectors on the partition

Signed-off-by: Reno Farnesi <nfarnesi4@gmail.com>
2017-08-26 14:56:07 -04:00
..
fat_write.c fs: fat: fix fatwrite overflow calculation 2017-08-26 14:56:07 -04:00
fat.c fs/fat: Correct blk_dread() return value check 2017-08-20 09:54:31 -04:00
file.c fat: Prepare API change for files greater than 2GB 2014-11-23 06:49:04 -05:00
Kconfig fs: fat: add kbuild configuration support 2017-06-03 17:55:16 -04:00
Makefile fs: convert makefiles to Kbuild style 2013-10-31 13:26:01 -04:00