coll/base: silence misc warning
as reported by Coverity with CIDs 1363349-1363362 Offset temporary buffer when a non zero lower bound datatype is used. Thanks Hristo Iliev for the report (cherry picked from commit 0e393195d9f2373ffa9d59a240092f643117cd39)
Этот коммит содержится в:
родитель
678d08647b
Коммит
7b8094aac1
@ -106,7 +106,7 @@ mca_coll_basic_allgather_inter(const void *sbuf, int scount,
|
||||
if (OMPI_SUCCESS != err) { line = __LINE__; goto exit; }
|
||||
|
||||
/* Step 2: exchange the resuts between the root processes */
|
||||
span = opal_datatype_span(&sdtype->super, scount * size, &gap);
|
||||
span = opal_datatype_span(&sdtype->super, (int64_t)scount * (int64_t)size, &gap);
|
||||
tmpbuf_free = (char *) malloc(span);
|
||||
if (NULL == tmpbuf_free) { line = __LINE__; err = OMPI_ERR_OUT_OF_RESOURCE; goto exit; }
|
||||
tmpbuf = tmpbuf_free - gap;
|
||||
|
@ -127,7 +127,7 @@ mca_coll_basic_reduce_scatter_block_inter(const void *sbuf, void *rbuf, int rcou
|
||||
int totalcounts;
|
||||
ptrdiff_t gap, span;
|
||||
char *tmpbuf = NULL, *tmpbuf2 = NULL;
|
||||
char *lbuf, *buf;
|
||||
char *lbuf = NULL, *buf;
|
||||
ompi_request_t *req;
|
||||
|
||||
rank = ompi_comm_rank(comm);
|
||||
|
@ -48,8 +48,8 @@ mca_coll_inter_allgather_inter(const void *sbuf, int scount,
|
||||
struct ompi_communicator_t *comm,
|
||||
mca_coll_base_module_t *module)
|
||||
{
|
||||
int rank, root = 0, size, rsize, err;
|
||||
char *ptmp_free = NULL, *ptmp;
|
||||
int rank, root = 0, size, rsize, err = OMPI_SUCCESS;
|
||||
char *ptmp_free = NULL, *ptmp = NULL;
|
||||
ptrdiff_t gap, span;
|
||||
ompi_request_t *req[2];
|
||||
|
||||
@ -59,7 +59,7 @@ mca_coll_inter_allgather_inter(const void *sbuf, int scount,
|
||||
|
||||
/* Perform the gather locally at the root */
|
||||
if ( scount > 0 ) {
|
||||
span = opal_datatype_span(&sdtype->super, scount*size, &gap);
|
||||
span = opal_datatype_span(&sdtype->super, (int64_t)scount*(int64_t)size, &gap);
|
||||
ptmp_free = (char*)malloc(span);
|
||||
if (NULL == ptmp_free) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
|
@ -49,7 +49,7 @@ mca_coll_inter_allgatherv_inter(const void *sbuf, int scount,
|
||||
{
|
||||
int i, rank, size, size_local, total=0, err;
|
||||
int *count=NULL,*displace=NULL;
|
||||
char *ptmp_free=NULL, *ptmp;
|
||||
char *ptmp_free=NULL, *ptmp=NULL;
|
||||
ompi_datatype_t *ndtype = NULL;
|
||||
ompi_request_t *req[2];
|
||||
|
||||
|
@ -62,7 +62,7 @@ mca_coll_inter_gather_inter(const void *sbuf, int scount,
|
||||
ptrdiff_t gap, span;
|
||||
|
||||
size_local = ompi_comm_size(comm->c_local_comm);
|
||||
span = opal_datatype_span(&sdtype->super, scount*size_local, &gap);
|
||||
span = opal_datatype_span(&sdtype->super, (int64_t)scount*(int64_t)size_local, &gap);
|
||||
|
||||
ptmp_free = (char*)malloc(span);
|
||||
if (NULL == ptmp_free) {
|
||||
|
@ -46,7 +46,7 @@ mca_coll_inter_gatherv_inter(const void *sbuf, int scount,
|
||||
{
|
||||
int i, rank, size, size_local, total=0, err;
|
||||
int *count=NULL, *displace=NULL;
|
||||
char *ptmp_free=NULL, *ptmp;
|
||||
char *ptmp_free=NULL, *ptmp=NULL;
|
||||
ompi_datatype_t *ndtype;
|
||||
|
||||
if (MPI_PROC_NULL == root) { /* do nothing */
|
||||
|
@ -56,13 +56,13 @@ mca_coll_inter_scatter_inter(const void *sbuf, int scount,
|
||||
err = OMPI_SUCCESS;
|
||||
} else if (MPI_ROOT != root) {
|
||||
/* First process receives the data from root */
|
||||
char *ptmp_free = NULL, *ptmp;
|
||||
char *ptmp_free = NULL, *ptmp = NULL;
|
||||
if(0 == rank) {
|
||||
int size_local;
|
||||
ptrdiff_t gap, span;
|
||||
|
||||
size_local = ompi_comm_size(comm->c_local_comm);
|
||||
span = opal_datatype_span(&rdtype->super, rcount*size_local, &gap);
|
||||
span = opal_datatype_span(&rdtype->super, (int64_t)rcount*(int64_t)size_local, &gap);
|
||||
ptmp_free = malloc(span);
|
||||
if (NULL == ptmp_free) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
|
@ -47,7 +47,7 @@ mca_coll_inter_scatterv_inter(const void *sbuf, const int *scounts,
|
||||
{
|
||||
int i, rank, size, err, total=0, size_local;
|
||||
int *counts=NULL,*displace=NULL;
|
||||
char *ptmp_free=NULL, *ptmp;
|
||||
char *ptmp_free=NULL, *ptmp=NULL;
|
||||
ompi_datatype_t *ndtype;
|
||||
|
||||
/* Initialize */
|
||||
|
@ -72,9 +72,9 @@ int ompi_coll_libnbc_iexscan(const void* sendbuf, void* recvbuf, int count, MPI_
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
if (inplace) {
|
||||
NBC_Copy(recvbuf, count, datatype, (char *)handle->tmpbuf-gap, count, datatype, comm);
|
||||
res = NBC_Copy(recvbuf, count, datatype, (char *)handle->tmpbuf-gap, count, datatype, comm);
|
||||
} else {
|
||||
NBC_Copy(sendbuf, count, datatype, (char *)handle->tmpbuf-gap, count, datatype, comm);
|
||||
res = NBC_Copy(sendbuf, count, datatype, (char *)handle->tmpbuf-gap, count, datatype, comm);
|
||||
}
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
NBC_Return_handle (handle);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user