Skip to content

Commit 57d3381

Browse files
chaseyugregkh
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 <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 14b9910 commit 57d3381

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)