f2fs: fix potential overflow
authorChao Yu <yuchao0@huawei.com>
Thu, 7 Nov 2019 09:29:00 +0000 (17:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2020 18:45:52 +0000 (19:45 +0100)
commit872340aa041eb12c831abee7d26d8e8f685a6a70
tree81ed1608b05f2205313c5c625bf86fc2d929f6c5
parentb9ffea4c1225aa5b1eba344708400a6fe6a71a1f
f2fs: fix potential overflow

commit 1f0d5c911b64165c9754139a26c8c2fad352c132 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/data.c
fs/f2fs/file.c