Skip to content

Commit b099eb8

Browse files
LiBaokun96tytso
authored andcommitted
ext4: remove unnecessary check from alloc_flex_gd()
In commit 967ac8a ("ext4: fix potential integer overflow in alloc_flex_gd()"), an overflow check is added to alloc_flex_gd() to prevent the allocated memory from being smaller than expected due to the overflow. However, after kmalloc() is replaced with kmalloc_array() in commit 6da2ec5 ("treewide: kmalloc() -> kmalloc_array()"), the kmalloc_array() function has an overflow check, so the above problem will not occur. Therefore, the extra check is removed. Signed-off-by: Baokun Li <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 658a523 commit b099eb8

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

fs/ext4/resize.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,7 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size)
236236
if (flex_gd == NULL)
237237
goto out3;
238238

239-
if (flexbg_size >= UINT_MAX / sizeof(struct ext4_new_group_data))
240-
goto out2;
241239
flex_gd->count = flexbg_size;
242-
243240
flex_gd->groups = kmalloc_array(flexbg_size,
244241
sizeof(struct ext4_new_group_data),
245242
GFP_NOFS);

0 commit comments

Comments
 (0)