diff options
| author | Tom Rini <[email protected]> | 2026-01-16 13:04:47 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-01-16 13:04:47 -0600 |
| commit | adccdb22ebd799a7d964892d4a7e7454ed3c239c (patch) | |
| tree | 04fa8942c4cbe7aeca90b1f30a66b4a8891bd25b /fs/ext4 | |
| parent | 8241bd6a82e181bbb3b7f4440a52205a40e2e617 (diff) | |
| parent | fc16c847a1c9c6e0ee1f605849cc500a04c21602 (diff) | |
Merge patch series "fix integer overflows in filesystem code"
This series from Timo tp Preißl <[email protected]> fixes some
(potential) interger overflows in some filesystems by using
__builtin_XXX_overflow helps to catch issues.
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'fs/ext4')
| -rw-r--r-- | fs/ext4/ext4_write.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c index 2b8ed1cd110..1abedcede72 100644 --- a/fs/ext4/ext4_write.c +++ b/fs/ext4/ext4_write.c @@ -108,7 +108,13 @@ int ext4fs_get_bgdtable(void) { int status; struct ext_filesystem *fs = get_fs(); - int gdsize_total = ROUND(fs->no_blkgrp * fs->gdsize, fs->blksz); + size_t alloc; + size_t gdsize_total; + + if (__builtin_mul_overflow(fs->no_blkgrp, fs->gdsize, &alloc)) + return -1; + + gdsize_total = ROUND(alloc, fs->blksz); fs->no_blk_pergdt = gdsize_total / fs->blksz; /* allocate memory for gdtable */ |
