Skip to content

Commit 8490853

Browse files
committed
coverity CID 1472861: dereferencing NULL groups was indeed incorrect
Signed-off-by: Aurelien Bouteiller <bouteill@icl.utk.edu>
1 parent af5d6f1 commit 8490853

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ompi/mca/coll/ftagree/coll_ftagree_earlyterminating.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ mca_coll_ftagree_eta_intra(void *contrib,
101101
{ /* ignore acked failures (add them later to the result) */
102102
ompi_group_t* ackedgrp = NULL; int npa; int *aranks, *cranks;
103103
ackedgrp = *group;
104-
if( 0 != (npa = ompi_group_size(ackedgrp)) ) {
104+
if( 0 != (npa = (NULL == ackedgrp? 0: ompi_group_size(ackedgrp))) ) {
105105
aranks = calloc( npa, sizeof(int) );
106106
for( i = 0; i < npa; i++ ) aranks[i] = i;
107107
cranks = calloc( npa, sizeof(int) );
@@ -336,7 +336,7 @@ mca_coll_ftagree_eta_intra(void *contrib,
336336
free(statuses);
337337
free(in);
338338
/* Let's build the group of failed processes */
339-
if( NULL != group ) {
339+
if( update_grp ) {
340340
int pos;
341341
/* We overwrite proc_status because it is not used anymore */
342342
int *failed = proc_status;
@@ -346,10 +346,10 @@ mca_coll_ftagree_eta_intra(void *contrib,
346346
failed[pos++] = i;
347347
}
348348
}
349-
if( update_grp ) {
349+
if( NULL != *group ) {
350350
OBJ_RELEASE(*group);
351-
ompi_group_incl(comm->c_remote_group, pos, failed, group);
352351
}
352+
ompi_group_incl(comm->c_remote_group, pos, failed, group);
353353
}
354354
free(proc_status);
355355

@@ -363,7 +363,7 @@ mca_coll_ftagree_eta_intra(void *contrib,
363363
OPAL_OUTPUT_VERBOSE((5, ompi_ftmpi_output_handle,
364364
"%s ftagree:agreement (ETA) return %d with 4 first bytes of result 0x%08x and dead group with %d processes",
365365
OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), ret, *(int*)contrib,
366-
(NULL == group) ? 0 : (*group)->grp_proc_count));
366+
(NULL == *group) ? 0 : (*group)->grp_proc_count));
367367
return ret;
368368
}
369369

0 commit comments

Comments
 (0)