aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/recovery.c
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2015-09-11 14:43:52 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2015-10-09 16:20:50 -0700
commit9edcdabf36422d15d01db73b0fa5487e418beff6 (patch)
tree0a0cf8522db1e617ef6cf9379ae9b5fd89e8a3bd /fs/f2fs/recovery.c
parentf2fs: fix incorrect searching position when shrinking extent cache (diff)
downloadlinux-dev-9edcdabf36422d15d01db73b0fa5487e418beff6.tar.xz
linux-dev-9edcdabf36422d15d01db73b0fa5487e418beff6.zip
f2fs: fix overflow of size calculation
We have potential overflow issue when calculating size of object, when we left shift index with PAGE_CACHE_SHIFT bits, if type of index has only 32-bits space in 32-bit architecture, left shifting will incur overflow, i.e: pgoff_t index = 0xFFFFFFFF; loff_t size = index << PAGE_CACHE_SHIFT; size: 0xFFFFF000 So we should cast index with 64-bits type to avoid this issue. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/recovery.c')
-rw-r--r--fs/f2fs/recovery.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index faec2ca004b9..acc21f20637b 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -570,7 +570,7 @@ out:
/* truncate meta pages to be used by the recovery */
truncate_inode_pages_range(META_MAPPING(sbi),
- MAIN_BLKADDR(sbi) << PAGE_CACHE_SHIFT, -1);
+ (loff_t)MAIN_BLKADDR(sbi) << PAGE_CACHE_SHIFT, -1);
if (err) {
truncate_inode_pages_final(NODE_MAPPING(sbi));