Re: [PATCH 3/4] block: optionally merge discontiguous discard bios into a single request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux