From: Christoph Hellwig <hch@lst.de>
To: Markus Stockhausen <stockhausen@collogia.de>
Cc: Christoph Hellwig <hch@lst.de>,
"pmenzel@molgen.mpg.de" <pmenzel@molgen.mpg.de>,
"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>
Subject: Re: another possible integer truncation in xfs
Date: Mon, 21 Aug 2017 10:16:03 +0200 [thread overview]
Message-ID: <20170821081603.GA6581@lst.de> (raw)
In-Reply-To: <12EF8D94C6F8734FB2FF37B9FBEDD173010E035CD2@EXCHANGE.collogia.de>
On Mon, Aug 21, 2017 at 08:01:03AM +0000, Markus Stockhausen wrote:
> Hi Christoph,
>
> out of curiosity I looked for other use cases of min_t in xfs. At least
> until 4.12 there is a similar constellation in xfs_dir2_leaf_readbuf:
>
> if (trim_map) {
> mip->map_blocks -= geo->fsbcount;
> /*
> * Loop to get rid of the extents for the
> * directory block.
> */
> for (i = geo->fsbcount; i > 0; ) {
> j = min_t(int, map->br_blockcount, i);
> map->br_blockcount -= j;
> map->br_startblock += j;
> map->br_startoff += j;
>
> The loop could go havoc if map->br_blockcount is larger than
> 2G. If you think it could classify for stable feel free to add it too.
I don't think it has a chance to be larger in practice, but we should
fix it anyway. I'll prepare a patch.
Thanks for spotting this!
next prev parent reply other threads:[~2017-08-21 8:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 8:01 another possible integer truncation in xfs Markus Stockhausen
2017-08-21 8:16 ` Christoph Hellwig [this message]
2017-08-22 16:41 ` Darrick J. Wong
2017-08-22 17:20 ` AW: " Markus Stockhausen
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=20170821081603.GA6581@lst.de \
--to=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
--cc=pmenzel@molgen.mpg.de \
--cc=stockhausen@collogia.de \
/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