Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid to dereference a null index when HAVE_TRACING.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 5 Nov 2013 21:02:17 +0000 (22:02 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 6 Nov 2013 14:14:45 +0000 (15:14 +0100)
(cherry picked from commit df9b8b6931c264f2e2877e201e31019e6e7dcad3)

src/smpi/smpi_pmpi.c

index 1339144..9206f28 100644 (file)
@@ -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[])