Skip to content

Commit f413ef6

Browse files
committed
apply romio314 patch to romio321
When romio314 was first pulled in an extra patch was applied to it, see commit 92f6c7c. Most of that patch is already present in vanilla romio321, but the fix for MPIO_DATATYPE_ISCOMMITTED() isn't. If that macro doesn't set err_ then some paths end up with a variable being used uninitialized. In particular you can trace through romio321/romio/mpi-io/read.c to see what happens with error_code. It's an uninitialized stack variable that goes through three MPIO_CHECK_* macros none of which set it. The macros consistently set error_code to a failure if they see something wrong, but they don't consistently set it to success when things are fine. And then in the last macro MPIO_CHECK_DATATYPE it tries to look at the value of error_code that was never set. Signed-off-by: Mark Allen <[email protected]>
1 parent d67619b commit f413ef6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ompi/mca/io/romio321/romio/mpi-io/mpioimpl.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
/*
33
*
44
* Copyright (C) 1997 University of Chicago.
5+
* Copyright (c) 2018 IBM Corporation. All rights reserved.
6+
* $COPYRIGHT$
57
* See COPYRIGHT notice in top-level directory.
68
*/
79

@@ -36,7 +38,12 @@
3638
#define ROMIO_THREAD_CS_ENTER()
3739
#define ROMIO_THREAD_CS_EXIT()
3840
#define ROMIO_THREAD_CS_YIELD()
39-
#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do {} while (0)
41+
/* The MPI_DATATYPE_ISCOMMITTED macro now always sets err_=0.
42+
This is an optimistic approach for Open MPI, but it is likely other
43+
upper layers already checked the datatype was committed.
44+
Not setting err_ is incorrect since it can lead to use of
45+
uninitialized variable.*/
46+
#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do { err_ = 0; } while (0)
4047
#ifdef HAVE_WINDOWS_H
4148
#define MPIU_UNREFERENCED_ARG(a) a
4249
#else

0 commit comments

Comments
 (0)