Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965689Ab3FULqi (ORCPT ); Fri, 21 Jun 2013 07:46:38 -0400 Received: from nat28.tlf.novell.com ([130.57.49.28]:44486 "EHLO nat28.tlf.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965496Ab3FULqg convert rfc822-to-8bit (ORCPT ); Fri, 21 Jun 2013 07:46:36 -0400 Message-Id: <51C4593702000078000DFA44@nat28.tlf.novell.com> X-Mailer: Novell GroupWise Internet Agent 12.0.2 Date: Fri, 21 Jun 2013 12:46:31 +0100 From: "Jan Beulich" To: "Roger Pau Monne" Cc: , "Konrad Rzeszutek Wilk" , Subject: Re: [Xen-devel] [PATCH 3/4] xen-blkback: check the number of iovecs before allocating a bios References: <1371812216-17093-1-git-send-email-roger.pau@citrix.com> <1371812216-17093-4-git-send-email-roger.pau@citrix.com> In-Reply-To: <1371812216-17093-4-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 943 Lines: 28 >>> On 21.06.13 at 12:56, Roger Pau Monne 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). 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. 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/