f2fs: fix to avoid overflow while left shift operation
PATCH 1/1 f2fs: fix to avoid overflow while left shift operation
From: Chao Yu <[email protected]>
[ Upstream commit 0fe1c6bec54ea68ed8c987b3890f2296364e77bb ]
Should cast type of folio->index from pgoff_t to loff_t to avoid overflow while left shift operation.
Fixes 3265d3db1f16 ("f2fs: support partial truncation on compressed inode")
Signed-off-by Chao Yu <[email protected]>
Signed-off-by Jaegeuk Kim <[email protected]>
[ 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 <[email protected]>
--- fs/f2fs/compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/compress.c +1 -1
@@ -1209,7 +1209,7 @@ int f2fs_truncate_partial_cluster(struct inode *inode, u64 from, bool lock)int i;for (i = cluster_size -1 ; i >=0 ; i--) { -loff_t start = rpages[i]->index <<PAGE_SHIFT ; +loff_t start = (loff_t )rpages[i]->index <<PAGE_SHIFT ;if (from <= start) {zero_user_segment (rpages[i],0 ,PAGE_SIZE );
Signature · 1 line
2.17.1