Skip to content

Commit 86a6ff5

Browse files
chaseyuopsiff
authored andcommitted
f2fs: fix to avoid overflow while left shift operation
[ Upstream commit 0fe1c6b ] Should cast type of folio->index from pgoff_t to loff_t to avoid overflow while left shift operation. Fixes: 3265d3d ("f2fs: support partial truncation on compressed inode") Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> [ Modification: Using rpages[i]->index instead of folio->index due to it was changed since commit:1cda5bc0b2fe ("f2fs: Use a folio in f2fs_truncate_partial_cluster()") on 6.14 ] Signed-off-by: Rajani Kantha <681739313@139.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit ef49378864bb1ed14cd48c8e687729e12714d849) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 755a884 commit 86a6ff5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/f2fs/compress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ int f2fs_truncate_partial_cluster(struct inode *inode, u64 from, bool lock)
12101210
int i;
12111211

12121212
for (i = cluster_size - 1; i >= 0; i--) {
1213-
loff_t start = rpages[i]->index << PAGE_SHIFT;
1213+
loff_t start = (loff_t)rpages[i]->index << PAGE_SHIFT;
12141214

12151215
if (from <= start) {
12161216
zero_user_segment(rpages[i], 0, PAGE_SIZE);

0 commit comments

Comments
 (0)