Skip to content

Commit 31d719d

Browse files
authored
Merge pull request #10676 from markalle/alltoall_large_mesg_fix
fixing an int overflow in the basic collectives alltoall
2 parents 263dca3 + 729ec6e commit 31d719d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ompi/mca/coll/base/coll_base_alltoall.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* reserved.
1515
* Copyright (c) 2014-2017 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
17-
* Copyright (c) 2017 IBM Corporation. All rights reserved.
17+
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
1818
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
1919
* reserved.
2020
* $COPYRIGHT$
@@ -104,19 +104,19 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
104104
ompi_proc_t *right_proc = ompi_comm_peer_lookup(comm, right);
105105
opal_convertor_clone(right_proc->super.proc_convertor, &convertor, 0);
106106
opal_convertor_prepare_for_send(&convertor, &rdtype->super, rcount,
107-
(char *) rbuf + right * rcount * extent);
107+
(char *) rbuf + (MPI_Aint) right * rcount * extent);
108108
packed_size = max_size;
109109
err = opal_convertor_pack(&convertor, &iov, &iov_count, &packed_size);
110110
if (1 != err) { goto error_hndl; }
111111

112112
/* Receive data from the right */
113-
err = MCA_PML_CALL(irecv ((char *) rbuf + right * rcount * extent, rcount, rdtype,
113+
err = MCA_PML_CALL(irecv ((char *) rbuf + (MPI_Aint) right * rcount * extent, rcount, rdtype,
114114
right, MCA_COLL_BASE_TAG_ALLTOALL, comm, &req));
115115
if (MPI_SUCCESS != err) { goto error_hndl; }
116116

117117
if( left != right ) {
118118
/* Send data to the left */
119-
err = MCA_PML_CALL(send ((char *) rbuf + left * rcount * extent, rcount, rdtype,
119+
err = MCA_PML_CALL(send ((char *) rbuf + (MPI_Aint) left * rcount * extent, rcount, rdtype,
120120
left, MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD,
121121
comm));
122122
if (MPI_SUCCESS != err) { goto error_hndl; }
@@ -125,7 +125,7 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
125125
if (MPI_SUCCESS != err) { goto error_hndl; }
126126

127127
/* Receive data from the left */
128-
err = MCA_PML_CALL(irecv ((char *) rbuf + left * rcount * extent, rcount, rdtype,
128+
err = MCA_PML_CALL(irecv ((char *) rbuf + (MPI_Aint) left * rcount * extent, rcount, rdtype,
129129
left, MCA_COLL_BASE_TAG_ALLTOALL, comm, &req));
130130
if (MPI_SUCCESS != err) { goto error_hndl; }
131131
}

0 commit comments

Comments
 (0)