Skip to content

Commit ba95588

Browse files
committed
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 <egabriel@central.uh.edu>
1 parent 849d045 commit ba95588

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ompi/mca/io/ompio/io_ompio_file_set_view.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
1313
* Copyright (c) 2015-2018 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
@@ -66,13 +66,17 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp,
6666
mca_common_ompio_data_t *data;
6767
ompio_file_t *fh;
6868

69+
if ( (strcmp(datarep, "native") && strcmp(datarep, "NATIVE"))) {
70+
return MPI_ERR_UNSUPPORTED_DATAREP;
71+
}
72+
6973
data = (mca_common_ompio_data_t *) fp->f_io_selected_data;
7074

7175
/* we need to call the internal file set view twice: once for the individual
7276
file pointer, once for the shared file pointer (if it is existent)
7377
*/
7478
fh = &data->ompio_fh;
75-
79+
7680
OPAL_THREAD_LOCK(&fp->f_lock);
7781
ret = mca_common_ompio_set_view(fh, disp, etype, filetype, datarep, info);
7882
OPAL_THREAD_UNLOCK(&fp->f_lock);

ompi/mpi/c/file_set_view.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
6464
OMPI_CHECK_DATATYPE_FOR_VIEW(rc, filetype, 0);
6565
}
6666
}
67+
if ( NULL == datarep) {
68+
rc = MPI_ERR_UNSUPPORTED_DATAREP;
69+
fh = MPI_FILE_NULL;
70+
}
6771
OMPI_ERRHANDLER_CHECK(rc, fh, rc, FUNC_NAME);
6872
}
6973

0 commit comments

Comments
 (0)