diff options
author | Joseph Qi <joseph.qi@huawei.com> | 2014-10-10 00:24:56 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-10 04:25:47 +0200 |
commit | 7fa05c6e46d76378d4403669ba6ea38364f910ac (patch) | |
tree | 6d90790c72435cd63486ccbce97c6c867e0e7b08 /fs/ocfs2/inode.h | |
parent | ocfs2/dlm: refactor error handling in dlm_alloc_ctxt (diff) | |
download | linux-7fa05c6e46d76378d4403669ba6ea38364f910ac.tar.xz linux-7fa05c6e46d76378d4403669ba6ea38364f910ac.zip |
ocfs2: fix shift left operations overflow
ocfs2_inode_info->ip_clusters and ocfs2_dinode->id1.bitmap1.i_total are
defined as type u32, so the shift left operations may overflow if volume
size is large, for example, 2TB and cluster size is 1MB.
Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Reviewed-by: Alex Chen <alex.chen@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/inode.h')
-rw-r--r-- | fs/ocfs2/inode.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index a6c991c0fc98..a9b76de46047 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h @@ -162,7 +162,7 @@ static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode) { int c_to_s_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits - 9; - return (blkcnt_t)(OCFS2_I(inode)->ip_clusters << c_to_s_bits); + return (blkcnt_t)OCFS2_I(inode)->ip_clusters << c_to_s_bits; } /* Validate that a bh contains a valid inode */ |