From 4ff860db1f21ff26dbd9d112c7d2cb174c91896a Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Tue, 5 May 2009 22:30:08 +0000 Subject: [PATCH] - Fix Coverity CID 477: In _correct_ programs only when (group->grp_proc_count - n) > 0, we may fill ranks_included (callers of ompi_group_excl make sure)... Therefore move the ranks_included loop into the true block of the if (which is changed from "!= 0" to ">0"). Otherwise, the initilization of k=0 and ranks_included=NULL is good for the ompi_group_incl (and submethods ompi_group_*). Tested on Linux w/ mpi_test_suite and MPIch testsuite: 4 grouptest_coll 4 groupcreate 4 grouptest This commit was SVN r21172. --- ompi/group/group.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ompi/group/group.c b/ompi/group/group.c index c56b3424c7..e2b8c9d7cb 100644 --- a/ompi/group/group.c +++ b/ompi/group/group.c @@ -239,31 +239,31 @@ int ompi_group_incl(ompi_group_t* group, int n, int *ranks, ompi_group_t **new_g int ompi_group_excl(ompi_group_t* group, int n, int *ranks, ompi_group_t **new_group) { - int i, j, k, result; int *ranks_included=NULL; - /* determine the list of included processes for the excl-method */ + /* determine the list of included processes for the excl-method */ k = 0; - if (0 != (group->grp_proc_count - n)) { + if (0 < (group->grp_proc_count - n)) { ranks_included = (int *)malloc( (group->grp_proc_count-n)*(sizeof(int))); - } - for (i=0 ; igrp_proc_count ; i++) { - for(j=0 ; jgrp_proc_count ; i++) { + for(j=0 ; j