@@ -124,7 +124,7 @@ int ompi_comm_set ( ompi_communicator_t **ncomm,
124
124
}
125
125
126
126
/*
127
- * if remote_group == OMPI_GROUP_NULL , then the new communicator
127
+ * if remote_group == &ompi_mpi_group_null , then the new communicator
128
128
* is forced to be an inter communicator.
129
129
*/
130
130
int ompi_comm_set_nb ( ompi_communicator_t * * ncomm ,
@@ -169,7 +169,7 @@ int ompi_comm_set_nb ( ompi_communicator_t **ncomm,
169
169
170
170
/* Set remote group and duplicate the local comm, if applicable */
171
171
if (0 < remote_size ) {
172
- if (NULL == remote_group || MPI_GROUP_NULL == remote_group ) {
172
+ if (NULL == remote_group || & ompi_mpi_group_null . group == remote_group ) {
173
173
ret = ompi_group_incl (oldcomm -> c_remote_group , remote_size ,
174
174
remote_ranks , & newcomm -> c_remote_group );
175
175
if (OPAL_UNLIKELY (OMPI_SUCCESS != ret )) {
@@ -181,7 +181,7 @@ int ompi_comm_set_nb ( ompi_communicator_t **ncomm,
181
181
ompi_group_increment_proc_count (newcomm -> c_remote_group );
182
182
}
183
183
}
184
- if (0 < remote_size || MPI_GROUP_NULL == remote_group ) {
184
+ if (0 < remote_size || & ompi_mpi_group_null . group == remote_group ) {
185
185
newcomm -> c_flags |= OMPI_COMM_INTER ;
186
186
if ( OMPI_COMM_IS_INTRA (oldcomm ) ) {
187
187
ompi_comm_idup (oldcomm , & newcomm -> c_local_comm , req );
@@ -273,7 +273,9 @@ int ompi_comm_create ( ompi_communicator_t *comm, ompi_group_t *group,
273
273
int rc = OMPI_SUCCESS ;
274
274
275
275
/* silence clang warning. newcomm should never be NULL */
276
- assert (NULL != newcomm );
276
+ if (OPAL_UNLIKELY (NULL == newcomm )) {
277
+ return OMPI_ERR_BAD_PARAM ;
278
+ }
277
279
278
280
lsize = group -> grp_proc_count ;
279
281
@@ -462,7 +464,10 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
462
464
}
463
465
464
466
/* silence clang warning. my_size should never be 0 here */
465
- assert (my_size > 0 );
467
+ if (OPAL_UNLIKELY (0 == my_size )) {
468
+ rc = OMPI_ERR_BAD_PARAM ;
469
+ goto exit ;
470
+ }
466
471
467
472
sorted = (int * ) calloc (my_size * 2 , sizeof (int ));
468
473
if ( NULL == sorted ) {
@@ -498,7 +503,7 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
498
503
/* Step 2: determine all the information for the remote group */
499
504
/* --------------------------------------------------------- */
500
505
if ( inter ) {
501
- remote_group = MPI_GROUP_NULL ;
506
+ remote_group = & ompi_mpi_group_null . group ;
502
507
rsize = comm -> c_remote_group -> grp_proc_count ;
503
508
rresults = (int * ) malloc ( rsize * 2 * sizeof (int ));
504
509
if ( NULL == rresults ) {
@@ -527,7 +532,7 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
527
532
rc = OMPI_ERR_OUT_OF_RESOURCE ;
528
533
goto exit ;
529
534
}
530
-
535
+
531
536
/* ok we can now fill this info */
532
537
for ( loc = 0 , i = 0 ; i < rsize ; i ++ ) {
533
538
if ( rresults [(2 * i )+ 0 ] == color ) {
@@ -536,7 +541,7 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
536
541
loc ++ ;
537
542
}
538
543
}
539
-
544
+
540
545
/* the new array needs to be sorted so that it is in 'key' order */
541
546
/* if two keys are equal then it is sorted in original rank order! */
542
547
if (my_rsize > 1 ) {
@@ -697,7 +702,9 @@ ompi_comm_split_type(ompi_communicator_t *comm,
697
702
ompi_comm_allgatherfct * allgatherfct = NULL ;
698
703
699
704
/* silence clang warning. newcomm should never be NULL */
700
- assert (NULL != newcomm );
705
+ if (OPAL_UNLIKELY (NULL == newcomm )) {
706
+ return OMPI_ERR_BAD_PARAM ;
707
+ }
701
708
702
709
/* Step 1: determine all the information for the local group */
703
710
/* --------------------------------------------------------- */
@@ -734,7 +741,10 @@ ompi_comm_split_type(ompi_communicator_t *comm,
734
741
}
735
742
736
743
/* silence a clang warning about a 0-byte malloc. my_size can not be 0 here */
737
- assert (my_size > 0 );
744
+ if (OPAL_UNLIKELY (0 == my_size )) {
745
+ rc = OMPI_ERR_BAD_PARAM ;
746
+ goto exit ;
747
+ }
738
748
739
749
sorted = (int * ) malloc ( sizeof ( int ) * my_size * 2 );
740
750
if ( NULL == sorted ) {
@@ -1335,7 +1345,9 @@ static int ompi_comm_allgather_emulate_intra( void *inbuf, int incount,
1335
1345
1336
1346
/* silence clang warning about 0-byte malloc. neither of these values can
1337
1347
* be 0 here */
1338
- assert (rsize > 0 && outcount > 0 );
1348
+ if (OPAL_UNLIKELY (0 == rsize || 0 == outcount )) {
1349
+ return OMPI_ERR_BAD_PARAM ;
1350
+ }
1339
1351
1340
1352
/* Step 1: the gather-step */
1341
1353
if ( 0 == rank ) {
@@ -1701,7 +1713,9 @@ int ompi_comm_determine_first ( ompi_communicator_t *intercomm, int high )
1701
1713
rsize = ompi_comm_remote_size (intercomm );
1702
1714
1703
1715
/* silence clang warnings. rsize can not be 0 here */
1704
- assert (rsize > 0 );
1716
+ if (OPAL_UNLIKELY (0 == rsize )) {
1717
+ return OMPI_ERR_BAD_PARAM ;
1718
+ }
1705
1719
1706
1720
rdisps = (int * ) calloc ( rsize , sizeof (int ));
1707
1721
if ( NULL == rdisps ){
0 commit comments