From ba955883329cc37aba89dc6bf0012bce8349d814 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 16 Oct 2018 12:45:33 -0500 Subject: [PATCH] io/ompio: add verification for data representations. check for providing a data representation that is actually supported by ompio. Add also one check for a non-NULL pointer in mpi/c/file_set_view for the data representation. Also fixes parts of issue #5643 Signed-off-by: Edgar Gabriel --- ompi/mca/io/ompio/io_ompio_file_set_view.c | 8 ++++++-- ompi/mpi/c/file_set_view.c | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ompi/mca/io/ompio/io_ompio_file_set_view.c b/ompi/mca/io/ompio/io_ompio_file_set_view.c index ba18db8fe1..72671c3410 100644 --- a/ompi/mca/io/ompio/io_ompio_file_set_view.c +++ b/ompi/mca/io/ompio/io_ompio_file_set_view.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. @@ -66,13 +66,17 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp, mca_common_ompio_data_t *data; ompio_file_t *fh; + if ( (strcmp(datarep, "native") && strcmp(datarep, "NATIVE"))) { + return MPI_ERR_UNSUPPORTED_DATAREP; + } + data = (mca_common_ompio_data_t *) fp->f_io_selected_data; /* we need to call the internal file set view twice: once for the individual file pointer, once for the shared file pointer (if it is existent) */ fh = &data->ompio_fh; - + OPAL_THREAD_LOCK(&fp->f_lock); ret = mca_common_ompio_set_view(fh, disp, etype, filetype, datarep, info); OPAL_THREAD_UNLOCK(&fp->f_lock); diff --git a/ompi/mpi/c/file_set_view.c b/ompi/mpi/c/file_set_view.c index a49a80f29a..c62df489aa 100644 --- a/ompi/mpi/c/file_set_view.c +++ b/ompi/mpi/c/file_set_view.c @@ -64,6 +64,10 @@ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, OMPI_CHECK_DATATYPE_FOR_VIEW(rc, filetype, 0); } } + if ( NULL == datarep) { + rc = MPI_ERR_UNSUPPORTED_DATAREP; + fh = MPI_FILE_NULL; + } OMPI_ERRHANDLER_CHECK(rc, fh, rc, FUNC_NAME); }