linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH v2 1/3] f2fs: fix to avoid overflow while left shift operation
@ 2025-08-04  1:43 Chao Yu via Linux-f2fs-devel
  2025-08-04  1:43 ` [f2fs-dev] [PATCH v2 2/3] f2fs: clean up f2fs_truncate_partial_cluster() Chao Yu via Linux-f2fs-devel
  2025-08-04  1:43 ` [f2fs-dev] [PATCH v2 3/3] f2fs: fix to zero data after EOF for compressed file correctly Chao Yu via Linux-f2fs-devel
  0 siblings, 2 replies; 5+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-08-04  1:43 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

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 <chao@kernel.org>
---
 fs/f2fs/compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 5c1f47e45dab..6cd8902849cf 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -1245,7 +1245,7 @@ int f2fs_truncate_partial_cluster(struct inode *inode, u64 from, bool lock)
 
 		for (i = cluster_size - 1; i >= 0; i--) {
 			struct folio *folio = page_folio(rpages[i]);
-			loff_t start = folio->index << PAGE_SHIFT;
+			loff_t start = (loff_t)folio->index << PAGE_SHIFT;
 
 			if (from <= start) {
 				folio_zero_segment(folio, 0, folio_size(folio));
-- 
2.49.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-05  2:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-04  1:43 [f2fs-dev] [PATCH v2 1/3] f2fs: fix to avoid overflow while left shift operation Chao Yu via Linux-f2fs-devel
2025-08-04  1:43 ` [f2fs-dev] [PATCH v2 2/3] f2fs: clean up f2fs_truncate_partial_cluster() Chao Yu via Linux-f2fs-devel
2025-08-04  1:43 ` [f2fs-dev] [PATCH v2 3/3] f2fs: fix to zero data after EOF for compressed file correctly Chao Yu via Linux-f2fs-devel
2025-08-05  2:42   ` Jaegeuk Kim via Linux-f2fs-devel
2025-08-05  2:51     ` Chao Yu via Linux-f2fs-devel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).