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

Re: [Xen-devel] [PATCH 3/4] xen-blkback: check the number of iovecs before allocating a bios



>>> On 21.06.13 at 12:56, Roger Pau Monne <roger.pau@xxxxxxxxxx> 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;
>  



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.