From 6611c000c9e652277b2bc30e21194bc883ce2bcb Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 28 Sep 2015 15:35:25 -0600 Subject: [PATCH 1/2] Fix coverity warnings Fix CID 1315271: Constant expression result The intent of this conditional is to not produce a peruse event for probe or mprobe requests. Coverity is correct that the expression is always true. Changed the || to && to fix. Also moved the conditional within an OMPI_WANT_PERUSE to ensure the conditional is not evaluated if peruse is disabled. Signed-off-by: Nathan Hjelm --- ompi/mca/pml/ob1/pml_ob1_recvreq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.c b/ompi/mca/pml/ob1/pml_ob1_recvreq.c index fdbc1309739..b7646890d03 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.c @@ -1059,16 +1059,16 @@ static inline void append_recv_req_to_queue(opal_list_t *queue, opal_list_append(queue, (opal_list_item_t*)req); +#if OMPI_WANT_PERUSE /** - * We don't want to generate this kind of event for MPI_Probe. Hopefully, - * the compiler will optimize out the empty if loop in the case where PERUSE - * support is not required by the user. + * We don't want to generate this kind of event for MPI_Probe. */ - if(req->req_recv.req_base.req_type != MCA_PML_REQUEST_PROBE || - req->req_recv.req_base.req_type != MCA_PML_REQUEST_MPROBE) { + if (req->req_recv.req_base.req_type != MCA_PML_REQUEST_PROBE && + req->req_recv.req_base.req_type != MCA_PML_REQUEST_MPROBE) { PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_REQ_INSERT_IN_POSTED_Q, &(req->req_recv.req_base), PERUSE_RECV); } +#endif } /* From 6b83fa2f58575c7b4a5f8112dd63b8b717681e15 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 28 Sep 2015 15:51:28 -0600 Subject: [PATCH 2/2] ompi/comm: fix coverity errors Fixes CID 1323841: Logically dead code Wrong value in conditional. Should be newcomp not newcomm. Fixes CID 1269762: Explicit null dereference ompi_group_incl could return an error and not set local_group. Add a check to ensure ompi_group_incl succeeded before incrementing the proc count. Signed-off-by: Nathan Hjelm --- ompi/communicator/comm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ompi/communicator/comm.c b/ompi/communicator/comm.c index bcf075f9677..538f4058a99 100644 --- a/ompi/communicator/comm.c +++ b/ompi/communicator/comm.c @@ -565,7 +565,11 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key, } } - ompi_group_incl(comm->c_local_group, my_size, lranks, &local_group); + rc = ompi_group_incl(comm->c_local_group, my_size, lranks, &local_group); + if (OMPI_SUCCESS != rc) { + goto exit; + } + ompi_group_increment_proc_count(local_group); mode = OMPI_COMM_CID_INTER; @@ -588,8 +592,7 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key, comm->error_handler,/* error handler */ pass_on_topo, local_group, /* local group */ - remote_group /* remote group */ - ); + remote_group); /* remote group */ if ( NULL == newcomp ) { rc = MPI_ERR_INTERN; @@ -918,7 +921,7 @@ ompi_comm_split_type(ompi_communicator_t *comm, NULL, /* local group */ NULL ); /* remote group */ - if ( NULL == newcomm ) { + if ( NULL == newcomp ) { rc = MPI_ERR_INTERN; goto exit; }