aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/hw/mlx5/cq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index 344ab03948a3..e7c64c57d699 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -653,8 +653,11 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int entries,
653 int eqn; 653 int eqn;
654 int err; 654 int err;
655 655
656 if (entries < 0)
657 return ERR_PTR(-EINVAL);
658
656 entries = roundup_pow_of_two(entries + 1); 659 entries = roundup_pow_of_two(entries + 1);
657 if (entries < 1 || entries > dev->mdev.caps.max_cqes) 660 if (entries > dev->mdev.caps.max_cqes)
658 return ERR_PTR(-EINVAL); 661 return ERR_PTR(-EINVAL);
659 662
660 cq = kzalloc(sizeof(*cq), GFP_KERNEL); 663 cq = kzalloc(sizeof(*cq), GFP_KERNEL);