Skip to content

Commit 31a8476

Browse files
author
Ralph Castain
authored
Merge pull request #2702 from rhc54/topic/cov
Silence Coverity CID 1398541
2 parents 5b1d4fd + e568b21 commit 31a8476

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,15 @@ static pmix_status_t send_msg(int sd, pmix_ptl_send_t *msg)
200200
/* header was fully written, but only a part of the msg data was written */
201201
msg->hdr_sent = true;
202202
rc -= msg->sdbytes;
203-
msg->sdptr = (char *)msg->data->base_ptr + rc;
203+
if (NULL != msg->data) {
204+
/* technically, this should never happen as iov_count
205+
* would be 1 for a zero-byte message, and so we cannot
206+
* have a case where we write the header and part of the
207+
* msg. However, code checkers don't know that and are
208+
* fooled by our earlier check for NULL, and so
209+
* we silence their warnings by using this check */
210+
msg->sdptr = (char *)msg->data->base_ptr + rc;
211+
}
204212
msg->sdbytes = ntohl(msg->hdr.nbytes) - rc;
205213
}
206214
return PMIX_ERR_RESOURCE_BUSY;

0 commit comments

Comments
 (0)