Skip to content

Commit 261341a

Browse files
LiBaokun96tytso
authored andcommitted
ext4: set the type of max_zeroout to unsigned int to avoid overflow
The max_zeroout is of type int and the s_extent_max_zeroout_kb is of type uint, and the s_extent_max_zeroout_kb can be freely modified via the sysfs interface. When the block size is 1024, max_zeroout may overflow, so declare it as unsigned int to avoid overflow. Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20240319113325.3110393-9-libaokun1@huawei.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 9a9f3a9 commit 261341a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/ext4/extents.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3402,9 +3402,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
34023402
struct ext4_extent *ex, *abut_ex;
34033403
ext4_lblk_t ee_block, eof_block;
34043404
unsigned int ee_len, depth, map_len = map->m_len;
3405-
int allocated = 0, max_zeroout = 0;
34063405
int err = 0;
34073406
int split_flag = EXT4_EXT_DATA_VALID2;
3407+
int allocated = 0;
3408+
unsigned int max_zeroout = 0;
34083409

34093410
ext_debug(inode, "logical block %llu, max_blocks %u\n",
34103411
(unsigned long long)map->m_lblk, map_len);

0 commit comments

Comments
 (0)