projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
64aa90f
)
RDMA/amso1100: Check for integer overflow in c2_alloc_cq_buf()
author
Dan Carpenter
<
[email protected]
>
Tue, 12 Aug 2014 23:20:04 +0000
(19:20 -0400)
committer
Roland Dreier
<
[email protected]
>
Wed, 13 Aug 2014 05:00:03 +0000
(22:00 -0700)
This is a static checker fix. The static checker says that q_size comes
from the user and can be any 32 bit value. The call tree is:
--> ib_uverbs_create_cq()
--> c2_create_cq()
--> c2_init_cq()
Signed-off-by: Dan Carpenter <
[email protected]
>
Signed-off-by: Doug Ledford <
[email protected]
>
Signed-off-by: Roland Dreier <
[email protected]
>
drivers/infiniband/hw/amso1100/c2_cq.c
patch
|
blob
|
history
diff --git
a/drivers/infiniband/hw/amso1100/c2_cq.c
b/drivers/infiniband/hw/amso1100/c2_cq.c
index 49e0e8533f748d8dc3bc8ccec234a22b0bfc242c..1b63185b4ad4fa977bc4f211fe159cd32c83aabb 100644
(file)
--- a/
drivers/infiniband/hw/amso1100/c2_cq.c
+++ b/
drivers/infiniband/hw/amso1100/c2_cq.c
@@
-260,11
+260,14
@@
static void c2_free_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq)
mq->msg_pool.host, dma_unmap_addr(mq, mapping));
}
-static int c2_alloc_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq,
int q_size,
-
in
t msg_size)
+static int c2_alloc_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq,
+
size_t q_size, size_
t msg_size)
{
u8 *pool_start;
+ if (q_size > SIZE_MAX / msg_size)
+ return -EINVAL;
+
pool_start = dma_alloc_coherent(&c2dev->pcidev->dev, q_size * msg_size,
&mq->host_dma, GFP_KERNEL);
if (!pool_start)