diff --git a/ompi/mpi/c/get_elements.c b/ompi/mpi/c/get_elements.c index 58b28119e4..2cbe0e3bde 100644 --- a/ompi/mpi/c/get_elements.c +++ b/ompi/mpi/c/get_elements.c @@ -38,7 +38,17 @@ int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count) size_t size; if (MPI_PARAM_CHECK) { + int err = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + if (NULL == status || MPI_STATUSES_IGNORE == status || + MPI_STATUS_IGNORE == status || NULL == count) { + err = MPI_ERR_ARG; + } else if (NULL == datatype || MPI_DATATYPE_NULL == datatype) { + err = MPI_ERR_TYPE; + } else { + OMPI_CHECK_DATATYPE_FOR_RECV(err, datatype, 1); + } + OMPI_ERRHANDLER_CHECK(err, MPI_COMM_WORLD, err, FUNC_NAME); } *count = 0; diff --git a/ompi/mpi/c/status_set_cancelled.c b/ompi/mpi/c/status_set_cancelled.c index 813389b1c6..eed4537c5d 100644 --- a/ompi/mpi/c/status_set_cancelled.c +++ b/ompi/mpi/c/status_set_cancelled.c @@ -34,7 +34,14 @@ static const char FUNC_NAME[] = "MPI_Status_set_cancelled"; int MPI_Status_set_cancelled(MPI_Status *status, int flag) { if (MPI_PARAM_CHECK) { + int rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + if (NULL == status || + MPI_STATUS_IGNORE == status || + MPI_STATUSES_IGNORE == status) { + rc = MPI_ERR_ARG; + } + OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME); } status->_cancelled = flag; diff --git a/ompi/mpi/c/status_set_elements.c b/ompi/mpi/c/status_set_elements.c index b4852b2369..33ffbba98c 100644 --- a/ompi/mpi/c/status_set_elements.c +++ b/ompi/mpi/c/status_set_elements.c @@ -44,18 +44,20 @@ int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, rc = MPI_ERR_TYPE; } else if (count < 0) { rc = MPI_ERR_COUNT; + } else if (NULL == status || + MPI_STATUS_IGNORE == status || + MPI_STATUSES_IGNORE == status) { + rc = MPI_ERR_ARG; } OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME); } - if (status != MPI_STATUS_IGNORE) { - if( ompi_ddt_is_predefined(datatype) ) { - ompi_ddt_type_size( datatype, &size ); - status->_count = (int)(count * size); - } else { - ompi_ddt_set_element_count( datatype, count, &size ); - status->_count = (int)size; - } + if( ompi_ddt_is_predefined(datatype) ) { + ompi_ddt_type_size( datatype, &size ); + status->_count = (int)(count * size); + } else { + ompi_ddt_set_element_count( datatype, count, &size ); + status->_count = (int)size; } return MPI_SUCCESS; }