[lvc-project] [PATCH] f2fs: Cast expression type to unsigned long in __count_extent_cache()
Chao Yu
chao at kernel.org
Wed Mar 6 04:48:38 MSK 2024
On 2024/3/5 16:09, Roman Smirnov wrote:
> 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 at omp.ru>
> Reviewed-by: Sergey Shtylyov <s.shtylyov at omp.ru>
Reviewed-by: Chao Yu <chao at kernel.org>
Thanks,
> ---
> 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);
> }
>
More information about the lvc-project
mailing list