summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2022-08-07 19:47:25 -0400
committerTheodore Ts'o <tytso@mit.edu>2022-08-07 19:49:33 -0400
commit5cfdceb4909d9ee6ac2502b83215fb71f5077e06 (patch)
tree8da558bd1d2e42e3338f81ac000bab9ca9dee5f2 /misc
parent80e1504f2ce33c9ebc5045009c7bcde9315526c0 (diff)
downloade2fsprogs-5cfdceb4909d9ee6ac2502b83215fb71f5077e06.tar.gz
Fix UBSAN if s_log_groups_per_flex is 31
It is logal (albeit rare) for the number of block groups per flex_bg to 2**31 (which effectively means to put all of the block groups into a single flex_bg). However, in that case "1 << 31" is undefined on architectures with a 32-bit integer. Fix this UBSAN complaint by using "1U << 31" instead. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r--misc/e4defrag.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index 86e97ee3..9ec265f2 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -1021,7 +1021,7 @@ static int get_best_count(ext4_fsblk_t block_count)
return 1;
if (feature_incompat & EXT4_FEATURE_INCOMPAT_FLEX_BG) {
- flex_bg_num = 1 << log_groups_per_flex;
+ flex_bg_num = 1U << log_groups_per_flex;
ret = ((block_count - 1) /
((ext4_fsblk_t)blocks_per_group *
flex_bg_num)) + 1;