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

2012-05-11 Thread Or Gerlitz
sebastien dugue sebastien.du...@bull.net wrote:
  @@ -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?

not really, good catch - unless we need to protect here from negative
values coming
e.g from user space, I'll look this up,  thanks

Or.

Or.
--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2012-05-11 Thread sebastien dugue
On Fri, 11 May 2012 10:39:12 +0300
Or Gerlitz or.gerl...@gmail.com wrote:

 sebastien dugue sebastien.du...@bull.net wrote:
   @@ -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?
 
 not really, good catch - unless we need to protect here from negative
 values coming
 e.g from user space, I'll look this up,  thanks
 
 Or.
 
 Or.


  A small test shows that for n  2, we have roundup_pow_of_two(n) == 1. But
this is with the current implementation and on x86_64, so maybe on other
architectures the test may still be needed after all.


  Sébastien.
--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html