From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
linux-block <linux-block@vger.kernel.org>,
linux-nvme <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH 3/4] block: optionally merge discontiguous discard bios into a single request
Date: Wed, 8 Feb 2017 12:57:10 +0100 [thread overview]
Message-ID: <20170208115710.GB11342@lst.de> (raw)
In-Reply-To: <CACVXFVOZfrLGb59q=V_O2xijM6t9uUq8Foj5qWZ5sAQpRSWngA@mail.gmail.com>
On Wed, Feb 08, 2017 at 06:54:24PM +0800, Ming Lei wrote:
> > + struct bio *bio)
> > +{
> > + unsigned short segments = blk_rq_nr_discard_segments(req);
> > +
> > + if (segments >= queue_max_discard_segments(q))
> > + goto no_merge;
> > + if (blk_rq_sectors(req) + bio_sectors(bio) >
> > + blk_rq_get_max_sectors(req, blk_rq_pos(req)))
> > + goto no_merge;
> > +
> > + req->biotail->bi_next = bio;
> > + req->biotail = bio;
> > + req->__data_len += bio->bi_iter.bi_size;
>
> typeof(__data_len) is unsigned, and should be easy to overflow
> for discard rq's merge.
We respect the max_discard_sectors setting which is unsigned as well
above in blk_rq_get_max_sectors(), so we can't actually overflow here.
And please remove the fullquote after your two line comment, thanks!
next prev parent reply other threads:[~2017-02-08 11:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-07 16:46 support for multi-range discard requests Christoph Hellwig
2017-02-07 16:46 ` [PATCH 1/4] block: move req_set_nomerge to blk.h Christoph Hellwig
2017-02-15 10:29 ` Sagi Grimberg
2017-02-07 16:46 ` [PATCH 2/4] block: enumify ELEVATOR_*_MERGE Christoph Hellwig
2017-02-15 10:31 ` Sagi Grimberg
2017-02-07 16:46 ` [PATCH 3/4] block: optionally merge discontiguous discard bios into a single request Christoph Hellwig
2017-02-08 10:54 ` Ming Lei
2017-02-08 11:57 ` Christoph Hellwig [this message]
2017-02-15 10:36 ` Sagi Grimberg
2017-02-07 16:46 ` [PATCH 4/4] nvme: support ranged discard requests Christoph Hellwig
2017-02-07 18:34 ` Keith Busch
2017-02-07 19:34 ` Christoph Hellwig
2017-02-15 10:42 ` Sagi Grimberg
-- strict thread matches above, loose matches on Subject: below --
2017-02-08 13:13 support for multi-range discard requests V2 Christoph Hellwig
2017-02-08 13:13 ` [PATCH 3/4] block: optionally merge discontiguous discard bios into a single request Christoph Hellwig
2017-02-08 13:46 support for multi-range discard requests V3 Christoph Hellwig
2017-02-08 13:46 ` [PATCH 3/4] block: optionally merge discontiguous discard bios into a single request Christoph Hellwig
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=20170208115710.GB11342@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=tom.leiming@gmail.com \
/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