[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51C440D6.2030107@citrix.com>
Date: Fri, 21 Jun 2013 14:02:30 +0200
From: Roger Pau Monné <roger.pau@...rix.com>
To: Jan Beulich <JBeulich@...e.com>
CC: <xen-devel@...ts.xen.org>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [Xen-devel] [PATCH 3/4] xen-blkback: check the number of iovecs
before allocating a bios
On 21/06/13 13:46, Jan Beulich wrote:
>>>> On 21.06.13 at 12:56, Roger Pau Monne <roger.pau@...rix.com> wrote:
>> @@ -1236,7 +1236,8 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
>> seg[i].nsec << 9,
>> seg[i].offset) == 0)) {
>>
>> - bio = bio_alloc(GFP_KERNEL, nseg-i);
>> + int nr_iovecs = (nseg-i) > BIO_MAX_PAGES ? BIO_MAX_PAGES : (nseg-i);
>
> I'm sure this results in a compiler warning (declaration after
> statement).
No, because it's the first statement inside the while loop.
> And it surely would read much better if you used some form of
> min() - the shorter line would at once allow you to properly
> blank separate operands from operators.
Sure, I will switch it to min, thanks for the comments.
>
> Jan
>
>> + bio = bio_alloc(GFP_KERNEL, nr_iovecs);
>> if (unlikely(bio == NULL))
>> goto fail_put_bio;
>>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists