All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: Cast expression type to unsigned long in __count_extent_cache()
@ 2024-03-05  8:09 ` Roman Smirnov
  0 siblings, 0 replies; 12+ messages in thread
From: Roman Smirnov @ 2024-03-05  8:09 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu
  Cc: Sergey Shtylyov, lvc-project, linux-kernel, Karina Yankevich,
	linux-f2fs-devel, Roman Smirnov

Cast expression type to unsigned long in __count_extent_cache()
to prevent integer overflow.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Signed-off-by: Roman Smirnov <r.smirnov@omp.ru>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 fs/f2fs/shrinker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
index 83d6fb97dcae..bb86a06c5d5e 100644
--- a/fs/f2fs/shrinker.c
+++ b/fs/f2fs/shrinker.c
@@ -33,7 +33,7 @@ static unsigned long __count_extent_cache(struct f2fs_sb_info *sbi,
 {
 	struct extent_tree_info *eti = &sbi->extent_tree[type];
 
-	return atomic_read(&eti->total_zombie_tree) +
+	return (unsigned long)atomic_read(&eti->total_zombie_tree) +
 				atomic_read(&eti->total_ext_node);
 }
 
-- 
2.34.1



_______________________________________________
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] 12+ messages in thread

end of thread, other threads:[~2024-03-11 21:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05  8:09 [f2fs-dev] [PATCH] f2fs: Cast expression type to unsigned long in __count_extent_cache() Roman Smirnov
2024-03-05  8:09 ` Roman Smirnov
2024-03-06  1:48 ` [f2fs-dev] " Chao Yu
2024-03-06  1:48   ` Chao Yu
2024-03-06 17:50 ` [f2fs-dev] " patchwork-bot+f2fs
2024-03-06 17:50   ` patchwork-bot+f2fs
2024-03-10 17:46 ` David Laight
2024-03-10 17:46   ` David Laight
2024-03-11 20:37   ` [f2fs-dev] " Jaegeuk Kim
2024-03-11 20:37     ` Jaegeuk Kim
2024-03-11 21:19     ` [f2fs-dev] " David Laight
2024-03-11 21:19       ` David Laight

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.