[PATCH v3 04/10] ext4: Create a var for the number of blocks to allocate
Simon Glass
sjg at chromium.org
Sat May 10 15:06:10 CEST 2025
Since this expression might overflow, put it in a variable.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
(no changes since v1)
fs/ext4/ext4_write.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c
index 8e6179c4a99..86420d1c9d7 100644
--- a/fs/ext4/ext4_write.c
+++ b/fs/ext4/ext4_write.c
@@ -108,9 +108,11 @@ int ext4fs_get_bgdtable(void)
{
int status;
struct ext_filesystem *fs = get_fs();
+ size_t alloc_size;
int gdsize_total;
- gdsize_total = ROUND(fs->no_blkgrp * fs->gdsize, fs->blksz);
+ alloc_size = fs->no_blkgrp * fs->gdsize;
+ gdsize_total = ROUND(alloc_size, fs->blksz);
fs->no_blk_pergdt = gdsize_total / fs->blksz;
/* allocate memory for gdtable */
--
2.43.0
More information about the U-Boot
mailing list