Skip to content

Commit

Permalink
UCT/DC: Fix out-of-bounds array access, found by coverity.
Browse files Browse the repository at this point in the history
  • Loading branch information
yosefe committed Sep 18, 2016
1 parent 6a13c04 commit 1dfaa0b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/uct/ib/dc/base/dc_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ ucs_status_t uct_dc_ep_pending_add(uct_ep_h tl_ep, uct_pending_req_t *r)
* - dci is either assigned or can be assigned
* - dci has resources
*/
if (uct_rc_iface_has_tx_resources(&iface->super) &&
((ep->dci != UCT_DC_EP_NO_DCI) || uct_dc_iface_dci_can_alloc(iface)) &&
uct_dc_iface_dci_ep_can_send(ep))
{
return UCS_ERR_BUSY;
if (uct_rc_iface_has_tx_resources(&iface->super)) {
if (ep->dci == UCT_DC_EP_NO_DCI) {
if (uct_dc_iface_dci_can_alloc(iface)) {
return UCS_ERR_BUSY;
}
} else {
if (uct_dc_iface_dci_ep_can_send(ep)) {
return UCS_ERR_BUSY;
}
}
}

UCS_STATIC_ASSERT(sizeof(ucs_arbiter_elem_t) <= UCT_PENDING_REQ_PRIV_LEN);
Expand Down

0 comments on commit 1dfaa0b

Please sign in to comment.