Skip to content

Commit 06af6f1

Browse files
authored
Merge pull request #4962 from jsquyres/pr/cid-fixes
A bunch of CID fixes
2 parents f92acd7 + 5360035 commit 06af6f1

File tree

11 files changed

+49
-27
lines changed

11 files changed

+49
-27
lines changed

ompi/dpm/dpm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2007-2018 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2006-2009 University of Houston. All rights reserved.
1515
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1616
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
@@ -958,6 +958,7 @@ int ompi_dpm_open_port(char *port_name)
958958
r = opal_rand(&rnd);
959959
opal_convert_process_name_to_string(&tmp, OMPI_PROC_MY_NAME);
960960
snprintf(port_name, MPI_MAX_PORT_NAME-1, "%s:%u", tmp, r);
961+
port_name[MPI_MAX_PORT_NAME - 1] = '\0';
961962
free(tmp);
962963
return OMPI_SUCCESS;
963964
}

ompi/mca/fbtl/posix/fbtl_posix.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2008-2015 University of Houston. All rights reserved.
13+
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved
1314
* $COPYRIGHT$
1415
*
1516
* Additional copyrights may follow
@@ -116,7 +117,7 @@ bool mca_fbtl_posix_progress ( mca_ompio_request_t *req)
116117
{
117118
bool ret=false;
118119
#if defined (FBTL_POSIX_HAVE_AIO)
119-
int i=0, lcount=0, ret_code;
120+
int i=0, lcount=0, ret_code=0;
120121
mca_fbtl_posix_request_data_t *data=(mca_fbtl_posix_request_data_t *)req->req_data;
121122
off_t start_offset, end_offset, total_length;
122123

ompi/mca/fcoll/static/fcoll_static_file_write_all.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Copyright (c) 2015-2017 Research Organization for Information Science
1515
* and Technology (RIST). All rights reserved.
1616
* Copyright (c) 2017 IBM Corporation. All rights reserved.
17+
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved
1718
* $COPYRIGHT$
1819
*
1920
* Additional copyrights may follow
@@ -947,9 +948,7 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh,
947948
#endif
948949

949950
}
950-
951-
if (my_aggregator == fh->f_rank) {
952-
} }
951+
}
953952

954953
#if OMPIO_FCOLL_WANT_TIME_BREAKDOWN
955954
end_exch = MPI_Wtime();
@@ -976,12 +975,12 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh,
976975
decoded_iov = NULL;
977976
}
978977

979-
if (my_aggregator == fh->f_rank) {
978+
if (NULL != local_iov_array){
979+
free(local_iov_array);
980+
local_iov_array = NULL;
981+
}
980982

981-
if (NULL != local_iov_array){
982-
free(local_iov_array);
983-
local_iov_array = NULL;
984-
}
983+
if (my_aggregator == fh->f_rank) {
985984
for(l=0;l<fh->f_procs_per_group;l++){
986985
if (NULL != blocklen_per_process[l]){
987986
free(blocklen_per_process[l]);

ompi/mca/io/ompio/io_ompio_aggregators.c

Lines changed: 6 additions & 1 deletion
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) 2008-2017 University of Houston. All rights reserved.
14-
* Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2011-2018 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2012-2013 Inria. All rights reserved.
1616
* Copyright (c) 2015-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
@@ -1296,12 +1296,17 @@ int mca_io_ompio_prepare_to_group(mca_io_ompio_file_t *fh,
12961296
if (NULL == aggr_bytes_per_group_tmp) {
12971297
opal_output (1, "OUT OF MEMORY\n");
12981298
ret = OMPI_ERR_OUT_OF_RESOURCE;
1299+
free(end_offsets_tmp);
12991300
goto exit;
13001301
}
13011302
decision_list_tmp = (int* )malloc (fh->f_init_num_aggrs * sizeof(int));
13021303
if (NULL == decision_list_tmp) {
13031304
opal_output (1, "OUT OF MEMORY\n");
13041305
ret = OMPI_ERR_OUT_OF_RESOURCE;
1306+
free(end_offsets_tmp);
1307+
if (NULL != aggr_bytes_per_group_tmp) {
1308+
free(aggr_bytes_per_group_tmp);
1309+
}
13051310
goto exit;
13061311
}
13071312
//Communicate bytes per group between all aggregators

ompi/mca/osc/pt2pt/osc_pt2pt_frag.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* reserved.
66
* Copyright (c) 2015 Research Organization for Information Science
77
* and Technology (RIST). All rights reserved.
8-
* Copyright (c) 2017 Cisco Systems, Inc. All rights reserved
8+
* Copyright (c) 2017-2018 Cisco Systems, Inc. All rights reserved
99
* $COPYRIGHT$
1010
*
1111
* Additional copyrights may follow
@@ -139,7 +139,7 @@ int ompi_osc_pt2pt_frag_flush_pending (ompi_osc_pt2pt_module_t *module, int targ
139139

140140
int ompi_osc_pt2pt_frag_flush_pending_all (ompi_osc_pt2pt_module_t *module)
141141
{
142-
int ret;
142+
int ret = OPAL_SUCCESS;
143143

144144
for (int i = 0 ; i < ompi_comm_size (module->comm) ; ++i) {
145145
ret = ompi_osc_pt2pt_frag_flush_pending (module, i);

ompi/mca/osc/rdma/osc_rdma_component.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Copyright (c) 2015 NVIDIA Corporation. All rights reserved.
1818
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
1919
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
20+
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved
2021
* $COPYRIGHT$
2122
*
2223
* Additional copyrights may follow
@@ -775,10 +776,12 @@ static int ompi_osc_rdma_query_mtls (void)
775776
if (mtls_to_use && ompi_mtl_base_selected_component) {
776777
for (int i = 0 ; mtls_to_use[i] ; ++i) {
777778
if (0 == strcmp (mtls_to_use[i], ompi_mtl_base_selected_component->mtl_version.mca_component_name)) {
779+
opal_argv_free(mtls_to_use);
778780
return OMPI_SUCCESS;
779781
}
780782
}
781783
}
784+
opal_argv_free(mtls_to_use);
782785
return -1;
783786
}
784787

ompi/mca/topo/treematch/treematch/tm_tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ void free_non_constraint_tree(tm_tree_t *tree)
132132
{
133133
int d = tree->dumb;
134134

135-
free_list_child(tree);
136135
free_tab_child(tree);
136+
free_list_child(tree);
137137
if(!d)
138138
FREE(tree);
139139
}

ompi/mpi/c/comm_join.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* All rights reserved.
1414
* Copyright (c) 2015 Research Organization for Information Science
1515
* and Technology (RIST). All rights reserved.
16-
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
16+
* Copyright (c) 2015-2018 Cisco Systems, Inc. All rights reserved
1717
* $COPYRIGHT$
1818
*
1919
* Additional copyrights may follow
@@ -110,26 +110,28 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
110110
send_first = true;
111111
}
112112

113-
/* ensure the port name is NULL terminated */
114-
memset(port_name, 0, MPI_MAX_PORT_NAME);
115-
116113
/* Assumption: socket_send should not block, even if the socket
117114
is not configured to be non-blocking, because the message length are
118115
so short. */
119116

120117
/* we will only use the send_first proc's port name,
121118
* so pass it to the recv_first participant */
122119
if (send_first) {
123-
/* open a port */
120+
// The port_name that we get back will be \0-terminated. The
121+
// strlen+\0 will be <= MPI_MAX_PORT_NAME characters.
124122
if (OMPI_SUCCESS != (rc = ompi_dpm_open_port(port_name))) {
125123
goto error;
126124
}
125+
// Send the strlen+1 so that we both send the \0 and the
126+
// receiver receives the \0.
127127
llen = (uint32_t)(strlen(port_name)+1);
128128
len = htonl(llen);
129129
ompi_socket_send( fd, (char *) &len, sizeof(uint32_t));
130130
ompi_socket_send (fd, port_name, llen);
131131
} else {
132132
ompi_socket_recv (fd, (char *) &rlen, sizeof(uint32_t));
133+
// The lrlen that we receive will be the strlen+1 (to account
134+
// for \0), and will be <= MPI_MAX_PORT_NAME.
133135
lrlen = ntohl(rlen);
134136
ompi_socket_recv (fd, port_name, lrlen);
135137
}

opal/mca/btl/sm/btl_sm_component.c

Lines changed: 3 additions & 1 deletion
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-2007 Voltaire. All rights reserved.
14-
* Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved
14+
* Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2010-2015 Los Alamos National Security, LLC.
1616
* All rights reserved.
1717
* Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved.
@@ -77,6 +77,8 @@ static int mca_btl_sm_component_register(void)
7777
}
7878
}
7979
}
80+
81+
opal_argv_free(names);
8082
}
8183

8284
// Tell the framework that we don't want this component to be

opal/mca/btl/tcp/btl_tcp_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,8 @@ static int mca_btl_tcp_component_exchange(void)
11831183
if ((AF_INET == my_ss.ss_family) &&
11841184
(4 != mca_btl_tcp_component.tcp_disable_family)) {
11851185
memcpy(&addrs[current_addr].addr_inet,
1186-
&((struct sockaddr_in*)&my_ss)->sin_addr,
1187-
sizeof(addrs[0].addr_inet));
1186+
&((struct sockaddr_in*)&my_ss)->sin_addr,
1187+
sizeof(struct in_addr));
11881188
addrs[current_addr].addr_port =
11891189
mca_btl_tcp_component.tcp_listen_port;
11901190
addrs[current_addr].addr_family = MCA_BTL_TCP_AF_INET;

0 commit comments

Comments
 (0)