Skip to content

Commit 0fe1c6b

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: fix to avoid overflow while left shift operation
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>
1 parent 1bd119d commit 0fe1c6b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/f2fs/compress.c

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

12461246
for (i = cluster_size - 1; i >= 0; i--) {
12471247
struct folio *folio = page_folio(rpages[i]);
1248-
loff_t start = folio->index << PAGE_SHIFT;
1248+
loff_t start = (loff_t)folio->index << PAGE_SHIFT;
12491249

12501250
if (from <= start) {
12511251
folio_zero_segment(folio, 0, folio_size(folio));

0 commit comments

Comments
 (0)