aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaokun Li <[email protected]>2024-03-19 19:33:23 +0800
committerTheodore Ts'o <[email protected]>2024-05-02 23:48:31 -0400
commit9a9f3a9842927e4af7ca10c19c94dad83bebd713 (patch)
tree8991341047e6829e7263a58a8b2fad8f3ddbab3b
parent63bfe841053f8dda09c9d059d543486d9dc16104 (diff)
ext4: set type of ac_groups_linear_remaining to __u32 to avoid overflow
Now ac_groups_linear_remaining is of type __u16 and s_mb_max_linear_groups is of type unsigned int, so an overflow occurs when setting a value above 65535 through the mb_max_linear_groups sysfs interface. Therefore, the type of ac_groups_linear_remaining is set to __u32 to avoid overflow. Fixes: 196e402adf2e ("ext4: improve cr 0 / cr 1 group scanning") CC: [email protected] Signed-off-by: Baokun Li <[email protected]> Reviewed-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
-rw-r--r--fs/ext4/mballoc.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 56938532b4ce..7bfc5fb5a128 100644
--- a/fs/ext4/mballoc.h
+++ b/fs/ext4/mballoc.h
@@ -193,8 +193,8 @@ struct ext4_allocation_context {
ext4_grpblk_t ac_orig_goal_len;
__u32 ac_flags; /* allocation hints */
+ __u32 ac_groups_linear_remaining;
__u16 ac_groups_scanned;
- __u16 ac_groups_linear_remaining;
__u16 ac_found;
__u16 ac_cX_found[EXT4_MB_NUM_CRS];
__u16 ac_tail;