diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-07-30 16:44:04 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-14 17:55:53 -0400 |
commit | 84032b6759024337a81ae5d8e23a39110381743b (patch) | |
tree | 53774a876d57ec8557ca4c6afd9f4b8798fca186 /fs/fat/fat_write.c | |
parent | 688d62bfc8e336b06b5d6c445333dc04f1283d8d (diff) | |
download | u-boot-84032b6759024337a81ae5d8e23a39110381743b.tar.gz u-boot-84032b6759024337a81ae5d8e23a39110381743b.tar.bz2 u-boot-84032b6759024337a81ae5d8e23a39110381743b.zip |
fs: fat: avoid multiplication overflow
The product of two 32 bit integers is a 32 bit integer. Hence
clustcount * bytesperclust may overflow on > 4 GiB devices.
Change the type of clustcount.
Fixes: cb8af8af5ba0 ("fs: fat: support write with non-zero offset")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'fs/fat/fat_write.c')
-rw-r--r-- | fs/fat/fat_write.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index a6294419b8..8b5d669b00 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -690,8 +690,8 @@ get_set_cluster(fsdata *mydata, __u32 clustnum, loff_t pos, __u8 *buffer, static u8 *tmpbuf_cluster; unsigned int bytesperclust = mydata->clust_size * mydata->sect_size; __u32 startsect; - loff_t wsize; - int clustcount, i, ret; + loff_t clustcount, wsize; + int i, ret; *gotsize = 0; if (!size) |