[<prev] [next>] [day] [month] [year] [list]
Message-ID: <c02efb8b-0ee0-665f-4b33-08ee694cc659@kernel.org>
Date: Mon, 1 Jul 2019 22:37:53 +0800
From: Chao Yu <chao@...nel.org>
To: Liu Song <fishland@...yun.com>, jaegeuk@...nel.org,
yuchao0@...wei.com
Cc: liu.song11@....com.cn, linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: use multiplication instead of division
in sanity_check_raw_super
Hi Song,
On 2019-7-1 21:38, Liu Song via Linux-f2fs-devel wrote:
> From: Liu Song <liu.song11@....com.cn>
>
> Use multiplication instead of division and be more
> consistent with f2fs_msg output information.
>
> Signed-off-by: Liu Song <liu.song11@....com.cn>
> ---
> fs/f2fs/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index af58b2cc21b8..eba4c0f9c347 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -2489,7 +2489,7 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
> return 1;
> }
>
> - if ((segment_count / segs_per_sec) < total_sections) {
I think we use division intentionally to avoid potential overflow when doing
multiplication.
You can see the detailed commit message in below fixing patch:
0cfe75c5b011 ("f2fs: enhance sanity_check_raw_super() to avoid potential overflows")
Thanks,
> + if (segment_count < (segs_per_sec * total_sections)) {
> f2fs_msg(sb, KERN_INFO,
> "Small segment_count (%u < %u * %u)",
> segment_count, segs_per_sec, total_sections);
>
Powered by blists - more mailing lists