aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2019-11-07 17:29:00 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2019-11-07 11:17:39 -0800
commit1f0d5c911b64165c9754139a26c8c2fad352c132 (patch)
tree0df6533d246f5da2285b26353c0dd277f4493bdd /fs/f2fs/file.c
parentf2fs: fix to update dir's i_pino during cross_rename (diff)
downloadwireguard-linux-1f0d5c911b64165c9754139a26c8c2fad352c132.tar.xz
wireguard-linux-1f0d5c911b64165c9754139a26c8c2fad352c132.zip
f2fs: fix potential overflow
We expect 64-bit calculation result from below statement, however in 32-bit machine, looped left shift operation on pgoff_t type variable may cause overflow issue, fix it by forcing type cast. page->index << PAGE_SHIFT; Fixes: 26de9b117130 ("f2fs: avoid unnecessary updating inode during fsync") Fixes: 0a2aa8fbb969 ("f2fs: refactor __exchange_data_block for speed up") Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index c31a5bbc8090..f1f507f6561a 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1139,7 +1139,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,
}
dn.ofs_in_node++;
i++;
- new_size = (dst + i) << PAGE_SHIFT;
+ new_size = (loff_t)(dst + i) << PAGE_SHIFT;
if (dst_inode->i_size < new_size)
f2fs_i_size_write(dst_inode, new_size);
} while (--ilen && (do_replace[i] || blkaddr[i] == NULL_ADDR));