From: Chris Mason <clm@fb.com>
To: "Holger Hoffstätte" <holger@applied-asynchrony.com>,
linux-btrfs@vger.kernel.org
Cc: <davej@codemonkey.org.uk>
Subject: Re: [PATCH] btrfs: fix integer overflow in calc_reclaim_items_nr
Date: Fri, 23 Jun 2017 12:40:12 -0400 [thread overview]
Message-ID: <049bbc67-6028-10d8-04e3-cfcba69b24be@fb.com> (raw)
In-Reply-To: <b033955e-c0ff-20da-0e98-f68a5eb767c8@applied-asynchrony.com>
On 06/23/2017 11:29 AM, Holger Hoffstätte wrote:
> On 06/23/17 16:32, Chris Mason wrote:
> [..]
>> -static inline int calc_reclaim_items_nr(struct btrfs_fs_info *fs_info,
>> +static inline u64 calc_reclaim_items_nr(struct btrfs_fs_info *fs_info,
>> u64 to_reclaim)
>> {
>> u64 bytes;
>> - int nr;
>> + u64 nr;
>>
>> bytes = btrfs_calc_trans_metadata_size(fs_info, 1);
>> nr = (int)div64_u64(to_reclaim, bytes);
> ^^^^^^^^^^
>
> Isn't this a bit odd? I can't even tell whether it matters, just randomly
> noticed it because I genuinely dislike type casts..
>
Crud, yes that's broken. Thanks!
-chris
next prev parent reply other threads:[~2017-06-23 16:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-23 14:32 [PATCH] btrfs: fix integer overflow in calc_reclaim_items_nr Chris Mason
2017-06-23 15:29 ` Holger Hoffstätte
2017-06-23 15:59 ` David Sterba
2017-06-23 16:40 ` Chris Mason [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-06-29 18:20 [PATCH v2] btrfs: fix validation of XATTR_ITEM dir items David Sterba
2017-06-29 18:20 ` [PATCH] btrfs: fix integer overflow in calc_reclaim_items_nr David Sterba
2017-06-29 18:24 ` David Sterba
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=049bbc67-6028-10d8-04e3-cfcba69b24be@fb.com \
--to=clm@fb.com \
--cc=davej@codemonkey.org.uk \
--cc=holger@applied-asynchrony.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;
as well as URLs for NNTP newsgroup(s).