1
1

the length of the iov array should be limited to IOV_MAX, which is defined in limits.h

This commit was SVN r32706.
Этот коммит содержится в:
Edgar Gabriel 2014-09-10 21:59:45 +00:00
родитель a90f12ad1d
Коммит 4ccc0f5ea2
2 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -22,6 +22,7 @@
#include "mpi.h"
#include <unistd.h>
#include <limits.h>
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
@ -65,9 +66,10 @@ ssize_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh )
}
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset +
if (((((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[i].length) ==
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset) {
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset)) &&
(iov_count < IOV_MAX ) ){
iov[iov_count].iov_base =
fh->f_io_array[i+1].memory_address;
iov[iov_count].iov_len = fh->f_io_array[i+1].length;

Просмотреть файл

@ -24,6 +24,7 @@
#include "mpi.h"
#include <unistd.h>
#include <sys/uio.h>
#include <limits.h>
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
@ -67,9 +68,10 @@ ssize_t mca_fbtl_posix_pwritev(mca_io_ompio_file_t *fh )
}
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset +
if ( (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[i].length) ==
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset) {
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset) &&
(iov_count < IOV_MAX )) {
iov[iov_count].iov_base =
fh->f_io_array[i+1].memory_address;
iov[iov_count].iov_len = fh->f_io_array[i+1].length;