Skip to content

Commit

Permalink
providers/irdma: Fix CQ size validation
Browse files Browse the repository at this point in the history
[ Upstream commit c58dfc3 ]

Taking into account a reserved entry to detect overflow.

Fixes: 14a0fc8 ("rdma-core/irdma: Implement device supported verb APIs")
Signed-off-by: Kamal Heib <[email protected]>
Signed-off-by: Nicolas Morey <[email protected]>
  • Loading branch information
Kamalheib authored and nmorey committed Jul 6, 2023
1 parent c23736e commit 294c43d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion providers/irdma/uverbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ static struct ibv_cq_ex *ucreate_cq(struct ibv_context *context,
return NULL;
}

if (attr_ex->cqe < IRDMA_MIN_CQ_SIZE || attr_ex->cqe > uk_attrs->max_hw_cq_size) {
if (attr_ex->cqe < IRDMA_MIN_CQ_SIZE || attr_ex->cqe > uk_attrs->max_hw_cq_size - 1) {
errno = EINVAL;
return NULL;
}
Expand Down

0 comments on commit 294c43d

Please sign in to comment.