f2fs: potential shift wrapping buf in f2fs_trim_fs()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 25 Sep 2014 11:39:17 +0000 (14:39 +0300)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 30 Sep 2014 22:34:56 +0000 (15:34 -0700)
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>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.h

index a7e3e9112100cc53962f48df2dbab1bf5aee6f11..afb73627a8eccdc28ae0f41b36f7dfdf938bcfff 100644 (file)
@@ -55,7 +55,7 @@
 #define TOTAL_BLKS(sbi)        (TOTAL_SEGS(sbi) << sbi->log_blocks_per_seg)
 
 #define MAX_BLKADDR(sbi)       (SEG0_BLKADDR(sbi) + TOTAL_BLKS(sbi))
-#define SEGMENT_SIZE(sbi)      (1 << (sbi->log_blocksize +             \
+#define SEGMENT_SIZE(sbi)      (1ULL << (sbi->log_blocksize +          \
                                        sbi->log_blocks_per_seg))
 
 #define START_BLOCK(sbi, segno)        (SEG0_BLKADDR(sbi) +                    \