From 2c7424783b67745c1a30e3541429eb5ed82e1402 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 5 Nov 2013 22:02:17 +0100 Subject: [PATCH 1/1] Avoid to dereference a null index when HAVE_TRACING. (cherry picked from commit df9b8b6931c264f2e2877e201e31019e6e7dcad3) --- src/smpi/smpi_pmpi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/smpi/smpi_pmpi.c b/src/smpi/smpi_pmpi.c index 1339144ef2..9206f28ef6 100644 --- a/src/smpi/smpi_pmpi.c +++ b/src/smpi/smpi_pmpi.c @@ -1568,7 +1568,8 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status) int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * status) { - int retval = 0; + if (index == NULL) + return MPI_ERR_ARG; smpi_bench_end(); #ifdef HAVE_TRACING @@ -1595,12 +1596,7 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__,extra); #endif - if (index == NULL) { - retval = MPI_ERR_ARG; - } else { - *index = smpi_mpi_waitany(count, requests, status); - retval = MPI_SUCCESS; - } + *index = smpi_mpi_waitany(count, requests, status); #ifdef HAVE_TRACING if(*index!=MPI_UNDEFINED){ int src_traced = srcs[*index]; @@ -1623,7 +1619,7 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta } #endif smpi_bench_begin(); - return retval; + return MPI_SUCCESS; } int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[]) -- 2.20.1