*info param.c: use stack string buffers
Coverity identified that we treated the possibility that one of the message buffers could be NULL in some places (because strdup() could fail), but not in others. So just use stack buffers that will never be NULL. This was CID 1269914.
Этот коммит содержится в:
родитель
8be0e0b0ca
Коммит
1e58920b4d
@ -197,6 +197,7 @@ void ompi_info_do_config(bool want_all)
|
||||
|
||||
/* Build a string describing what level of compliance the mpi_f08
|
||||
module has */
|
||||
char f08_msg[1024];
|
||||
if (OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS) {
|
||||
|
||||
/* Do we have everything? (not including PROTECTED, which
|
||||
@ -209,38 +210,41 @@ void ompi_info_do_config(bool want_all)
|
||||
OMPI_FORTRAN_HAVE_PROCEDURE &&
|
||||
OMPI_FORTRAN_HAVE_C_FUNLOC &&
|
||||
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES) {
|
||||
fortran_usempif08_compliance = strdup("The mpi_f08 module is available, and is fully compliant. w00t!");
|
||||
fortran_usempif08_compliance = "The mpi_f08 module is available, and is fully compliant. w00t!";
|
||||
} else {
|
||||
char f08[1024];
|
||||
int first = 1;
|
||||
snprintf(f08, sizeof(f08),
|
||||
snprintf(f08_msg, sizeof(f08_msg),
|
||||
"The mpi_f08 module is available, but due to limitations in the %s compiler, does not support the following: ",
|
||||
OMPI_FC);
|
||||
if (!OMPI_BUILD_FORTRAN_F08_SUBARRAYS) {
|
||||
append(f08, sizeof(f08), &first, "array subsections");
|
||||
append(f08_msg, sizeof(f08_msg), &first, "array subsections");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_PRIVATE) {
|
||||
append(f08, sizeof(f08), &first, "private MPI_Status members");
|
||||
append(f08_msg, sizeof(f08_msg), &first,
|
||||
"private MPI_Status members");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_ABSTRACT) {
|
||||
append(f08, sizeof(f08), &first, "ABSTRACT INTERFACE function pointers");
|
||||
append(f08_msg, sizeof(f08_msg), &first,
|
||||
"ABSTRACT INTERFACE function pointers");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_ASYNCHRONOUS) {
|
||||
append(f08, sizeof(f08), &first, "Fortran '08-specified ASYNCHRONOUS behavior");
|
||||
append(f08_msg, sizeof(f08_msg), &first,
|
||||
"Fortran '08-specified ASYNCHRONOUS behavior");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_PROCEDURE) {
|
||||
append(f08, sizeof(f08), &first, "PROCEDUREs");
|
||||
append(f08_msg, sizeof(f08_msg), &first, "PROCEDUREs");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_C_FUNLOC) {
|
||||
append(f08, sizeof(f08), &first, "C_FUNLOCs");
|
||||
append(f08_msg, sizeof(f08_msg), &first, "C_FUNLOCs");
|
||||
}
|
||||
if (OMPI_FORTRAN_NEED_WRAPPER_ROUTINES) {
|
||||
append(f08, sizeof(f08), &first, "direct passthru (where possible) to underlying Open MPI's C functionality");
|
||||
append(f08_msg, sizeof(f08_msg), &first,
|
||||
"direct passthru (where possible) to underlying Open MPI's C functionality");
|
||||
}
|
||||
fortran_usempif08_compliance = strdup(f08);
|
||||
fortran_usempif08_compliance = f08_msg;
|
||||
}
|
||||
} else {
|
||||
fortran_usempif08_compliance = strdup("The mpi_f08 module was not built");
|
||||
fortran_usempif08_compliance = "The mpi_f08 module was not built";
|
||||
}
|
||||
|
||||
java = OMPI_WANT_JAVA_BINDINGS ? "yes" : "no";
|
||||
@ -329,9 +333,6 @@ void ompi_info_do_config(bool want_all)
|
||||
fortran_usempif08);
|
||||
opal_info_out("Fort mpi_f08 compliance", "bindings:use_mpi_f08:compliance",
|
||||
fortran_usempif08_compliance);
|
||||
if (NULL != fortran_usempif08_compliance) {
|
||||
free(fortran_usempif08_compliance);
|
||||
}
|
||||
opal_info_out("Fort mpi_f08 subarrays", "bindings:use_mpi_f08:subarrays-supported",
|
||||
fortran_build_f08_subarrays);
|
||||
opal_info_out("Java bindings", "bindings:java", java);
|
||||
|
@ -174,6 +174,7 @@ void oshmem_info_do_config(bool want_all)
|
||||
|
||||
/* Build a string describing what level of compliance the mpi_f08
|
||||
module has */
|
||||
char f08_msg[1024];
|
||||
if (OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS) {
|
||||
|
||||
/* Do we have everything? */
|
||||
@ -184,38 +185,41 @@ void oshmem_info_do_config(bool want_all)
|
||||
OMPI_FORTRAN_HAVE_PROCEDURE &&
|
||||
OMPI_FORTRAN_HAVE_C_FUNLOC &&
|
||||
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES) {
|
||||
fortran_usempif08_compliance = strdup("The mpi_f08 module is available, and is fully compliant. w00t!");
|
||||
fortran_usempif08_compliance = "The mpi_f08 module is available, and is fully compliant. w00t!";
|
||||
} else {
|
||||
char f08[1024];
|
||||
int first = 1;
|
||||
snprintf(f08, sizeof(f08),
|
||||
snprintf(f08_msg, sizeof(f08_msg),
|
||||
"The mpi_f08 module is available, but due to limitations in the %s compiler, does not support the following: ",
|
||||
OMPI_FC);
|
||||
if (!OMPI_BUILD_FORTRAN_F08_SUBARRAYS) {
|
||||
append(f08, sizeof(f08), &first, "array subsections");
|
||||
append(f08_msg, sizeof(f08_msg), &first, "array subsections");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_PRIVATE) {
|
||||
append(f08, sizeof(f08), &first, "private MPI_Status members");
|
||||
append(f08_msg, sizeof(f08_msg), &first,
|
||||
"private MPI_Status members");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_ABSTRACT) {
|
||||
append(f08, sizeof(f08), &first, "ABSTRACT INTERFACE function pointers");
|
||||
append(f08_msg, sizeof(f08_msg), &first,
|
||||
"ABSTRACT INTERFACE function pointers");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_ASYNCHRONOUS) {
|
||||
append(f08, sizeof(f08), &first, "Fortran '08-specified ASYNCHRONOUS behavior");
|
||||
append(f08_msg, sizeof(f08_msg), &first,
|
||||
"Fortran '08-specified ASYNCHRONOUS behavior");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_PROCEDURE) {
|
||||
append(f08, sizeof(f08), &first, "PROCEDUREs");
|
||||
append(f08_msg, sizeof(f08_msg), &first, "PROCEDUREs");
|
||||
}
|
||||
if (!OMPI_FORTRAN_HAVE_C_FUNLOC) {
|
||||
append(f08, sizeof(f08), &first, "C_FUNLOCs");
|
||||
append(f08_msg, sizeof(f08_msg), &first, "C_FUNLOCs");
|
||||
}
|
||||
if (OMPI_FORTRAN_NEED_WRAPPER_ROUTINES) {
|
||||
append(f08, sizeof(f08), &first, "direct passthru (where possible) to underlying Open MPI's C functionality");
|
||||
append(f08_msg, sizeof(f08_msg), &first,
|
||||
"direct passthru (where possible) to underlying Open MPI's C functionality");
|
||||
}
|
||||
fortran_usempif08_compliance = strdup(f08);
|
||||
fortran_usempif08_compliance = f08_msg;
|
||||
}
|
||||
} else {
|
||||
fortran_usempif08_compliance = strdup("The mpi_f08 module was not built");
|
||||
fortran_usempif08_compliance = "The mpi_f08 module was not built";
|
||||
}
|
||||
|
||||
java = OMPI_WANT_JAVA_BINDINGS ? "yes" : "no";
|
||||
@ -304,9 +308,6 @@ void oshmem_info_do_config(bool want_all)
|
||||
fortran_usempif08);
|
||||
opal_info_out("Fort mpi_f08 compliance", "bindings:use_mpi_f08:compliance",
|
||||
fortran_usempif08_compliance);
|
||||
if (NULL != fortran_usempif08_compliance) {
|
||||
free(fortran_usempif08_compliance);
|
||||
}
|
||||
opal_info_out("Fort mpi_f08 subarrays", "bindings:use_mpi_f08:subarrays-supported",
|
||||
fortran_build_f08_subarrays);
|
||||
opal_info_out("Java bindings", "bindings:java", java);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user