f2fs: potential shift wrapping buf in f2fs_trim_fs()
Subsystems (2)
PATCH 1/1 f2fs: potential shift wrapping buf in f2fs_trim_fs()
My static checker complains that segment is a u64 but only the lower 31 bits can be used before we hit a shift wrapping bug.
Signed-off-by Dan Carpenter <[email protected]>
fs/f2fs/segment.c +1 -1
@@ -949,7 +949,7 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)block_t start_addr =SM_I (sbi)->main_blkaddr;__u64 start = range->start >> sbi->log_blocksize;__u64 end = start + (range->len >> sbi->log_blocksize) -1 ; -__u64 segment =1 << (sbi->log_blocksize + sbi->log_blocks_per_seg); +__u64 segment =1ULL << (sbi->log_blocksize + sbi->log_blocks_per_seg);unsigned int start_segno, end_segno;struct cp_control cpc;