diff options
author | Noa Osherovich <noaos@mellanox.com> | 2016-06-04 08:15:34 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-06-07 10:03:50 -0400 |
commit | 9ea578528656e191c1097798a771ff08bab6f323 (patch) | |
tree | ca2eaee8b47d9550f470768982ab776503902258 | |
parent | 2cc6ad5f2130733e561f97dba7a2052f8ea024aa (diff) |
IB/mlx5: Fix entries checks in mlx5_ib_create_cq
Number of entries shouldn't be greater than the device's max
capability. This should be checked before rounding the entries number
to power of two.
Fixes: 51ee86a4af639 ('IB/mlx5: Fix check of number of entries...')
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/hw/mlx5/cq.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c index dabcc65bd65e..3984c68caae1 100644 --- a/drivers/infiniband/hw/mlx5/cq.c +++ b/drivers/infiniband/hw/mlx5/cq.c | |||
@@ -822,7 +822,8 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, | |||
822 | int eqn; | 822 | int eqn; |
823 | int err; | 823 | int err; |
824 | 824 | ||
825 | if (entries < 0) | 825 | if (entries < 0 || |
826 | (entries > (1 << MLX5_CAP_GEN(dev->mdev, log_max_cq_sz)))) | ||
826 | return ERR_PTR(-EINVAL); | 827 | return ERR_PTR(-EINVAL); |
827 | 828 | ||
828 | if (check_cq_create_flags(attr->flags)) | 829 | if (check_cq_create_flags(attr->flags)) |