From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [bug report] f2fs: use BLKS_PER_SEG, BLKS_PER_SEC, and SEGS_PER_SEC
Date: Tue, 27 Feb 2024 09:42:11 -0800 [thread overview]
Message-ID: <Zd4e8286KuPqLRaU@google.com> (raw)
In-Reply-To: <0dbca927-9037-4ccd-ac1e-98ade64a2a0b@moroto.mountain>
On 02/27, Dan Carpenter wrote:
> Hello Jaegeuk Kim,
>
> The patch 9c1d3cd4ff8c: "f2fs: use BLKS_PER_SEG, BLKS_PER_SEC, and
> SEGS_PER_SEC" from Feb 6, 2024 (linux-next), leads to the following
> Smatch static checker warning:
>
> fs/f2fs/gc.c:2092 update_fs_metadata()
> warn: cast after binop
>
> fs/f2fs/gc.c
> 2089 static void update_fs_metadata(struct f2fs_sb_info *sbi, int secs)
> 2090 {
> 2091 int segs = secs * SEGS_PER_SEC(sbi);
> --> 2092 long long blks = (long long)(segs << sbi->log_blocks_per_seg);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Originally this was something like:
>
> long long blks = (long long)segs << sbi->log_blocks_per_seg;
Thanks. I just reverted this line back to the original cast one.
>
> So the cast seemed necessary to avoid an integer overflow.
>
> 2093 long long user_block_count =
> 2094 le64_to_cpu(F2FS_CKPT(sbi)->user_block_count);
> 2095
> 2096 SM_I(sbi)->segment_count = (int)SM_I(sbi)->segment_count + segs;
> 2097 MAIN_SEGS(sbi) = (int)MAIN_SEGS(sbi) + segs;
>
> regards,
> dan carpenter
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
prev parent reply other threads:[~2024-02-27 17:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 15:22 [f2fs-dev] [bug report] f2fs: use BLKS_PER_SEG, BLKS_PER_SEC, and SEGS_PER_SEC Dan Carpenter
2024-02-27 17:42 ` Jaegeuk Kim [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zd4e8286KuPqLRaU@google.com \
--to=jaegeuk@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.