Skip to content

Commit f9cfa55

Browse files
committed
fix coverity issues
1 parent 357e92f commit f9cfa55

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

src_c/IMB_chk_diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ Output variables:
515515
j2 = j_sample;
516516
}
517517

518-
MPI_ERRHAND(MPI_File_seek(restore, (MPI_Offset)(j1*Totalsize), MPI_SEEK_SET));
518+
MPI_ERRHAND(MPI_File_seek(restore, (MPI_Offset)j1*(MPI_Offset)Totalsize, MPI_SEEK_SET));
519519

520520
for (j = j1; j <= j2 && faultpos == CHK_NO_FAULT /*faultpos<0*/; j++) {
521521
IMB_Assert(Totalsize <= INT_MAX);

src_c/IMB_read.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ Output variables:
346346
} /*if( pos == indv_block )*/
347347
else if (pos == explic) {
348348
for (j = 0; j < j_sample; j++) {
349-
Offset = c_info->split.Offset + (MPI_Offset)(j*Totalsize);
349+
Offset = c_info->split.Offset + (MPI_Offset)j*(MPI_Offset)Totalsize;
350350

351351
MPI_ERRHAND(GEN_File_read_at(c_info->fh, Offset, c_info->r_buffer, Locsize, c_info->etype, &stat));
352352

@@ -442,8 +442,7 @@ void IMB_iread_ij(struct comm_info* c_info, int size, POSITIONING pos,
442442
}
443443
} else if (pos == explic) {
444444
for (j = 0; j < i_sample*j_sample; j++) {
445-
446-
Offset = c_info->split.Offset + (MPI_Offset)(j*Totalsize);
445+
Offset = c_info->split.Offset + (MPI_Offset)j*(MPI_Offset)Totalsize;
447446

448447
MPI_ERRHAND(MPI_File_read_at_all_begin(c_info->fh, Offset, c_info->r_buffer, Locsize, c_info->etype));
449448

@@ -515,7 +514,7 @@ void IMB_iread_ij(struct comm_info* c_info, int size, POSITIONING pos,
515514
}
516515
} else if (pos == explic) {
517516
for (j = 0; j < j_sample; j++) {
518-
Offset = c_info->split.Offset + (MPI_Offset)(j*Totalsize);
517+
Offset = c_info->split.Offset + (MPI_Offset)j*(MPI_Offset)Totalsize;
519518

520519
MPI_ERRHAND(MPI_File_iread_at(c_info->fh, Offset, c_info->r_buffer, Locsize, c_info->etype, &REQUESTS[j]));
521520

src_c/IMB_write.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ void IMB_write_ij(struct comm_info* c_info, int size, POSITIONING pos,
306306
}
307307
} else if (pos == explic) {
308308
for (j = 0; j < j_sample; j++) {
309-
Offset = c_info->split.Offset + (MPI_Offset)((i + j)*Totalsize);
309+
Offset = c_info->split.Offset + (MPI_Offset)(i + j)*(MPI_Offset)Totalsize;
310310

311311
MPI_ERRHAND(GEN_File_write_at(c_info->fh, Offset, c_info->s_buffer, Locsize, c_info->etype, &stat));
312312

@@ -406,7 +406,7 @@ void IMB_iwrite_ij(struct comm_info* c_info, int size, POSITIONING pos,
406406
}
407407
} else if (pos == explic) {
408408
for (j = 0; j < i_sample*j_sample; j++) {
409-
Offset = c_info->split.Offset + (MPI_Offset)(j*Totalsize);
409+
Offset = c_info->split.Offset + (MPI_Offset)j*(MPI_Offset)Totalsize;
410410

411411
MPI_ERRHAND(MPI_File_write_at_all_begin(c_info->fh, Offset, c_info->s_buffer, Locsize, c_info->etype));
412412

@@ -471,7 +471,7 @@ void IMB_iwrite_ij(struct comm_info* c_info, int size, POSITIONING pos,
471471
} else if (pos == explic) {
472472
for (j = 0; j < j_sample; j++)
473473
{
474-
Offset = c_info->split.Offset + (MPI_Offset)((i + j)*Totalsize);
474+
Offset = c_info->split.Offset + (MPI_Offset)(i + j)*(MPI_Offset)Totalsize;
475475

476476
MPI_ERRHAND(MPI_File_iwrite_at(c_info->fh, Offset, c_info->s_buffer, Locsize, c_info->etype, &REQUESTS[j]));
477477

src_c/P2P/imb_p2p_stencil3d.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ void imb_p2p_stencil3d(void) {
5959
length_z++;
6060
}
6161
while ((length_x * length_y * length_z) > nranks) {
62-
int n, lx, ly;
62+
int lx, ly, n = 0;
6363
length_z--;
6464
while ((length_z > 1) && (nranks % length_z)) {
6565
length_z--;
6666
}
67-
n = nranks / length_z;
67+
if (length_z != 0) {
68+
n = nranks / length_z;
69+
}
6870
lx = 2;
6971
ly = 2;
7072
while ((lx * ly) < n) {

0 commit comments

Comments
 (0)