* [patch] f2fs: potential shift wrapping buf in f2fs_trim_fs()
@ 2014-09-25 11:39 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-09-25 11:39 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: Changman Lee, linux-f2fs-devel, kernel-janitors
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 <dan.carpenter@oracle.com>
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index b423005..d8ed1b8 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-25 11:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25 11:39 [patch] f2fs: potential shift wrapping buf in f2fs_trim_fs() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).