Re: [PATCH for-next 3/6] IB/mlx4: Fix parameter checking in create_cq

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


Hi,

On Thu, 10 May 2012 23:28:06 +0300
Or Gerlitz <ogerlitz@xxxxxxxxxxxx> wrote:

> From: Eli Cohen <eli@xxxxxxxxxxxx>
> 
> Round up the number of entries before checking against the device's
> capabilities and not after that.
> 
> Signed-off-by: Eli Cohen <eli@xxxxxxxxxxxx>
> ---
>  drivers/infiniband/hw/mlx4/cq.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
> index f69ccd2..222a06c 100644
> --- a/drivers/infiniband/hw/mlx4/cq.c
> +++ b/drivers/infiniband/hw/mlx4/cq.c
> @@ -172,6 +172,7 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector
>  	struct mlx4_uar *uar;
>  	int err;
>  
> +	entries      = roundup_pow_of_two(entries + 1);
>  	if (entries < 1 || entries > dev->dev->caps.max_cqes)

  Is the first check still needed here then?


  Sébastien.


>  		return ERR_PTR(-EINVAL);
>  
> @@ -179,7 +180,6 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector
>  	if (!cq)
>  		return ERR_PTR(-ENOMEM);
>  
> -	entries      = roundup_pow_of_two(entries + 1);
>  	cq->ibcq.cqe = entries - 1;
>  	mutex_init(&cq->resize_mutex);
>  	spin_lock_init(&cq->lock);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Home]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]

Add to Google Powered by Linux