From: Cengiz Can <cengiz@kernel.wtf>
To: <dsterba@suse.cz>
Cc: <linux-btrfs@vger.kernel.org>, Chris Mason <clm@fb.com>,
Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Subject: Re: [PATCH] fs: btrfs: prevent unintentional int overflow
Date: Tue, 07 Jan 2020 18:23:45 +0300 [thread overview]
Message-ID: <16f809ac7e8.2bfa.85c738e3968116fc5c0dc2de74002084@kernel.wtf> (raw)
In-Reply-To: <20200106155328.GK3929@twin.jikos.cz>
On January 6, 2020 18:53:40 David Sterba <dsterba@suse.cz> wrote:
> The overflow can't happen in practice. Taking generous maximum value for
> an item and sectorsize (64K) and doing the math will reach nowhere the
> overflow limit for 32bit type:
>
> 64K / 4 * 64K = 1G
I didn't know that. Thanks for sharing.
> I'm not sure if this is worth adding the cast, or mark the coverity
> issue as not important.
If the cast is adding any overhead (which I don't think it does) I would
kindly request adding it for the sake of completeness.
For example: if some newbie like me tries adding something, they would be
warned that we should consider possible overflows and/or at least be
careful with expressions that contain different sized integers.
If this sounds unnecessary, I will help with marking the Coverity issue as
unimportant.
Thank you!
next prev parent reply other threads:[~2020-01-07 15:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-03 18:47 [PATCH] fs: btrfs: prevent unintentional int overflow Cengiz Can
2020-01-06 15:53 ` David Sterba
2020-01-07 15:23 ` Cengiz Can [this message]
2020-01-07 16:01 ` David Sterba
2020-01-07 19:44 ` Cengiz Can
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=16f809ac7e8.2bfa.85c738e3968116fc5c0dc2de74002084@kernel.wtf \
--to=cengiz@kernel.wtf \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox