From: "Holger Hoffstätte" <holger@applied-asynchrony.com>
To: Chris Mason <clm@fb.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 17:29:56 +0200 [thread overview]
Message-ID: <b033955e-c0ff-20da-0e98-f68a5eb767c8@applied-asynchrony.com> (raw)
In-Reply-To: <20170623143240.1245989-1-clm@fb.com>
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..
-h
next prev parent reply other threads:[~2017-06-23 15:29 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 [this message]
2017-06-23 15:59 ` David Sterba
2017-06-23 16:40 ` Chris Mason
-- 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=b033955e-c0ff-20da-0e98-f68a5eb767c8@applied-asynchrony.com \
--to=holger@applied-asynchrony.com \
--cc=clm@fb.com \
--cc=davej@codemonkey.org.uk \
--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).