projects
/
GitHub
/
exynos8895
/
android_kernel_samsung_universal8895.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
959f585
)
IB/mlx5: Fix check of number of entries in create CQ
author
Eli Cohen
<eli@dev.mellanox.co.il>
Wed, 23 Oct 2013 06:53:13 +0000
(09:53 +0300)
committer
Roland Dreier
<roland@purestorage.com>
Fri, 8 Nov 2013 22:42:58 +0000
(14:42 -0800)
Verify that the value is non negative before rounding up to power of 2.
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx5/cq.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/infiniband/hw/mlx5/cq.c
b/drivers/infiniband/hw/mlx5/cq.c
index 344ab03948a315cafc0422863f70a6e30443ff49..e7c64c57d6999c84ba156fd123dcc454cd646a32 100644
(file)
--- 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,
int eqn;
int err;
+ if (entries < 0)
+ return ERR_PTR(-EINVAL);
+
entries = roundup_pow_of_two(entries + 1);
- if (entries
< 1 || entries
> dev->mdev.caps.max_cqes)
+ if (entries > dev->mdev.caps.max_cqes)
return ERR_PTR(-EINVAL);
cq = kzalloc(sizeof(*cq), GFP_KERNEL);