Skip to content

Commit c2e208c

Browse files
authored
Merge pull request #11060 from jsquyres/pr/cid-fixes
A variety of CID fixes
2 parents 37d7dc9 + cc8d75f commit c2e208c

File tree

7 files changed

+22
-15
lines changed

7 files changed

+22
-15
lines changed

ompi/instance/instance.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/*
33
* Copyright (c) 2018-2022 Triad National Security, LLC. All rights
44
* reserved.
5+
* Copyright (c) 2022 Cisco Systems, Inc. All rights reserved.
56
* $COPYRIGHT$
67
*
78
* Additional copyrights may follow
@@ -818,10 +819,10 @@ int ompi_mpi_instance_init (int ts_level, opal_info_t *info, ompi_errhandler_t
818819
new_instance = OBJ_NEW(ompi_instance_t);
819820
if (OPAL_UNLIKELY(NULL == new_instance)) {
820821
if (0 == opal_atomic_add_fetch_32 (&ompi_instance_count, -1)) {
821-
ret = ompi_mpi_instance_finalize_common ();
822-
if (OPAL_UNLIKELY(OPAL_SUCCESS != ret)) {
823-
opal_mutex_unlock (&instance_lock);
824-
}
822+
// We can't do anything if an error occurs here because
823+
// we're already in an error path, so don't even bother to
824+
// look at the return value.
825+
(void) ompi_mpi_instance_finalize_common ();
825826
}
826827
opal_mutex_unlock (&instance_lock);
827828
return OMPI_ERR_OUT_OF_RESOURCE;

ompi/mca/coll/base/coll_base_allreduce.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2018 Siberian State University of Telecommunications
1919
* and Information Science. All rights reserved.
20+
* Copyright (c) 2022 Cisco Systems, Inc. All rights reserved.
2021
* $COPYRIGHT$
2122
*
2223
* Additional copyrights may follow
@@ -982,7 +983,9 @@ int ompi_coll_base_allreduce_intra_redscat_allgather(
982983

983984
/* Find nearest power-of-two less than or equal to comm_size */
984985
int nsteps = opal_hibit(comm_size, comm->c_cube_dim + 1); /* ilog2(comm_size) */
985-
assert(nsteps >= 0);
986+
if (-1 == nsteps) {
987+
return MPI_ERR_ARG;
988+
}
986989
int nprocs_pof2 = 1 << nsteps; /* flp2(comm_size) */
987990

988991
if (count < nprocs_pof2 || !ompi_op_is_commute(op)) {

ompi/mca/coll/base/coll_base_reduce.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
1818
* Copyright (c) 2018 Siberian State University of Telecommunications
1919
* and Information Science. All rights reserved.
20+
* Copyright (c) 2022 Cisco Systems, Inc. All rights reserved.
2021
* $COPYRIGHT$
2122
*
2223
* Additional copyrights may follow
@@ -812,7 +813,9 @@ int ompi_coll_base_reduce_intra_redscat_gather(
812813

813814
/* Find nearest power-of-two less than or equal to comm_size */
814815
int nsteps = opal_hibit(comm_size, comm->c_cube_dim + 1); /* ilog2(comm_size) */
815-
assert(nsteps >= 0);
816+
if (-1 == nsteps) {
817+
return MPI_ERR_ARG;
818+
}
816819
int nprocs_pof2 = 1 << nsteps; /* flp2(comm_size) */
817820

818821
if (nprocs_pof2 < 2 || count < nprocs_pof2 || !ompi_op_is_commute(op)) {

ompi/mca/coll/basic/coll_basic_reduce_scatter_block.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Copyright (c) 2014-2018 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* Copyright (c) 2022 IBM Corporation. All rights reserved.
18+
* Copyright (c) 2022 Cisco Systems, Inc. All rights reserved.
1819
* $COPYRIGHT$
1920
*
2021
* Additional copyrights may follow
@@ -174,9 +175,5 @@ mca_coll_basic_reduce_scatter_block_inter(const void *sbuf, void *rbuf, int rcou
174175
free(tmpbuf);
175176
}
176177

177-
if (NULL != tmpbuf2) {
178-
free(tmpbuf2);
179-
}
180-
181178
return err;
182179
}

opal/mca/base/mca_base_component_repository.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ int mca_base_component_repository_add(const char *path)
211211
path_to_use = strdup(path);
212212

213213
dir = strtok_r(path_to_use, sep, &ctx);
214+
if (NULL == dir) {
215+
goto done;
216+
}
214217
do {
215218
if ((0 == strcmp(dir, "USER_DEFAULT") || 0 == strcmp(dir, "USR_DEFAULT"))
216219
&& NULL != mca_base_user_default_path) {
@@ -224,6 +227,7 @@ int mca_base_component_repository_add(const char *path)
224227
}
225228
} while (NULL != (dir = strtok_r(NULL, sep, &ctx)));
226229

230+
done:
227231
free(path_to_use);
228232

229233
#endif /* OPAL_HAVE_DL_SUPPORT */

opal/mca/mpool/hugepage/mpool_hugepage_component.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2006 Voltaire. All rights reserved.
14-
* Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2007-2022 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights
1616
* reserved.
1717
* Copyright (c) 2016 Intel, Inc. All rights reserved.
@@ -238,9 +238,8 @@ static void mca_mpool_hugepage_find_hugepages(void)
238238
}
239239

240240
tok = strtok_r(opts, ",", &ctx);
241-
242241
do {
243-
if (0 == strncmp(tok, "pagesize", 8)) {
242+
if (NULL != tok && 0 == strncmp(tok, "pagesize", 8)) {
244243
break;
245244
}
246245
tok = strtok_r(NULL, ",", &ctx);

opal/util/ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2016 Karol Mroz. All rights reserved.
33
* Copyright (c) 2016 Research Organization for Information Science
44
* and Technology (RIST). All rights reserved.
5-
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
5+
* Copyright (c) 2016-2022 Cisco Systems, Inc. All rights reserved.
66
* $COPYRIGHT$
77
*
88
* Additional copyrights may follow
@@ -63,7 +63,7 @@ unsigned int opal_ethtool_get_speed(const char *if_name)
6363
}
6464

6565
memset(&ifr, 0, sizeof(struct ifreq));
66-
opal_string_copy(ifr.ifr_name, if_name, OPAL_IF_NAMESIZE);
66+
opal_string_copy(ifr.ifr_name, if_name, IF_NAMESIZE);
6767
ifr.ifr_data = (char *) &edata;
6868

6969
if (ioctl(sockfd, SIOCETHTOOL, &ifr) < 0) {

0 commit comments

Comments
 (0)