Skip to content

Commit 659fcf8

Browse files
committed
Merge pull request open-mpi#606 from hjelmn/v2.x_coverity
btl/openib: fix udcm coverity errors
2 parents edbbe19 + 34093ce commit 659fcf8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

opal/mca/btl/openib/connect/btl_openib_connect_udcm.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,8 +2631,8 @@ static int udcm_xrc_recv_qp_connect (mca_btl_openib_endpoint_t *lcl_ep)
26312631
lcl_ep->xrc_recv_qp = ibv_open_qp(openib_btl->device->ib_dev_context, &attr);
26322632
if (NULL == lcl_ep->xrc_recv_qp) { /* failed to regester the qp, so it is already die and we should create new one */
26332633
/* Return NOT READY !!!*/
2634-
BTL_ERROR(("Failed to register qp_num: %d , get error: %s (%d)\n. Replying with RNR",
2635-
lcl_ep->xrc_recv_qp->qp_num, strerror(errno), errno));
2634+
BTL_ERROR(("Failed to register qp_num: %d, get error: %s (%d)\n. Replying with RNR",
2635+
qp_num, strerror(errno), errno));
26362636
return OPAL_ERROR;
26372637
} else {
26382638
BTL_VERBOSE(("Connected to XRC Recv qp [%d]", lcl_ep->xrc_recv_qp->qp_num));
@@ -2908,6 +2908,9 @@ static int udcm_xrc_handle_xconnect (mca_btl_openib_endpoint_t *lcl_ep, udcm_msg
29082908
int response_type;
29092909
int rc = OPAL_ERROR;
29102910

2911+
/* sanity check on message type */
2912+
assert (UDCM_MESSAGE_XCONNECT == msg_hdr->type || UDCM_MESSAGE_XCONNECT2 == msg_hdr->type);
2913+
29112914
do {
29122915
if (NULL == udep) {
29132916
break;
@@ -2964,7 +2967,9 @@ static int udcm_xrc_handle_xconnect (mca_btl_openib_endpoint_t *lcl_ep, udcm_msg
29642967
return OPAL_SUCCESS;
29652968
} while (0);
29662969

2967-
opal_mutex_unlock (&udep->udep_lock);
2970+
if (udep) {
2971+
opal_mutex_unlock (&udep->udep_lock);
2972+
}
29682973

29692974
/* Reject the request */
29702975
BTL_VERBOSE(("rejecting request for reason %d", rej_reason));

0 commit comments

Comments
 (0)