f2fs: bug fix on bit overflow from 32bits to 64bits
This patch fixes some bit overflows by the shift operations. Dan Carpenter reported potential bugs on bit overflows as follows. fs/f2fs/segment.c:910 submit_write_page() warn: should 'blk_addr << ((sbi)->log_blocksize - 9)' be a 64 bit type? fs/f2fs/checkpoint.c:429 get_valid_checkpoint() warn: should '1 << ()' be a 64 bit type? fs/f2fs/data.c:408 f2fs_readpage() warn: should 'blk_addr << ((sbi)->log_blocksize - 9)' be a 64 bit type? fs/f2fs/data.c:457 submit_read_page() warn: should 'blk_addr << ((sbi)->log_blocksize - 9)' be a 64 bit type? fs/f2fs/data.c:525 get_data_block_ro() warn: should 'i << blkbits' be a 64 bit type? Bug-Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
@@ -525,7 +525,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock,
|
||||
!= (dn.data_blkaddr + i)) || maxblocks == i)
|
||||
break;
|
||||
map_bh(bh_result, inode->i_sb, dn.data_blkaddr);
|
||||
bh_result->b_size = (i << blkbits);
|
||||
bh_result->b_size = (((size_t)i) << blkbits);
|
||||
}
|
||||
f2fs_put_dnode(&dn);
|
||||
trace_f2fs_get_data_block(inode, iblock, bh_result, 0);
|
||||
|
Reference in New Issue
Block a user