public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: <xen-devel@lists.xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH 3/4] xen-blkback: check the number of iovecs before allocating a bios
Date: Fri, 21 Jun 2013 14:02:30 +0200	[thread overview]
Message-ID: <51C440D6.2030107@citrix.com> (raw)
In-Reply-To: <51C4593702000078000DFA44@nat28.tlf.novell.com>

On 21/06/13 13:46, Jan Beulich wrote:
>>>> On 21.06.13 at 12:56, Roger Pau Monne <roger.pau@citrix.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;
>>  
> 
> 


  reply	other threads:[~2013-06-21 12:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21 10:56 [PATCH 0/4] xen-block: bug fixes for indirect-descriptors Roger Pau Monne
2013-06-21 10:56 ` [PATCH 1/4] xen-blkback: workaround compiler bug in gcc 4.1 Roger Pau Monne
2013-06-21 10:56 ` [PATCH 2/4] xen-blkfront: set blk_queue_max_hw_sectors correctly Roger Pau Monne
2013-06-21 10:56 ` [PATCH 3/4] xen-blkback: check the number of iovecs before allocating a bios Roger Pau Monne
2013-06-21 11:46   ` [Xen-devel] " Jan Beulich
2013-06-21 12:02     ` Roger Pau Monné [this message]
2013-06-22  7:59   ` [PATCH v2 " Roger Pau Monne
2013-06-24 13:28     ` Konrad Rzeszutek Wilk
2013-06-25  8:03       ` Roger Pau Monné
2013-06-21 10:56 ` [PATCH 4/4] xen-blkfront: increase the default number of indirect segments Roger Pau Monne
2013-06-21 11:49   ` [Xen-devel] " Jan Beulich

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=51C440D6.2030107@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xen.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