Skip to content
Snippets Groups Projects
Commit ac94102b authored by Rémi Dehenne's avatar Rémi Dehenne
Browse files

Fix invalid arg type in MPI_Win_get_attr

The attribute_val argument of MPI_Win_get_attr was improperly set regarding
to the MPI Standard.
Prior to casting, the attribute_val argument must be an int** or void**.
MPC assumed attribute_val to be an int* or void*, thus leading to
unexpected behaviors in user applications.
parent f4713532
Branches
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ checksums = [ ...@@ -19,6 +19,7 @@ checksums = [
patches = [ patches = [
'nvdimm.patch', 'nvdimm.patch',
'pmix.patch', 'pmix.patch',
'rma-get-attr.patch',
] ]
builddependencies = [ builddependencies = [
......
From 831247ca5ab5589e42be0864bc3d1965b7cec914 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Dehenne?= <remi.dehenne@cea.fr>
Date: Fri, 27 Oct 2023 18:44:31 +0200
Subject: [PATCH] RMA: Fix invalid arg type in MPI_Win_get_attr
The attribute_val argument of MPI_Win_get_attr was improperly set regarding
to the MPI Standard.
Prior to casting, the attribute_val argument must be an int** or void**.
MPC assumed attribute_val to be an int* or void*, thus leading to
unexpected behaviors in user applications.
---
src/MPC_MPI/src/mpi_rma_win.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/MPC_MPI/src/mpi_rma_win.c b/src/MPC_MPI/src/mpi_rma_win.c
index de22d11db..c02ba4d9c 100644
--- a/src/MPC_MPI/src/mpi_rma_win.c
+++ b/src/MPC_MPI/src/mpi_rma_win.c
@@ -1163,7 +1163,6 @@ int mpc_MPI_Win_get_attr(MPI_Win win, int keyval, void *attr_val, int *flag)
}
struct mpc_lowcomm_rdma_window *low_win = sctk_win_translate(win);
- uintptr_t val;
/* First handle special values */
switch(keyval)
@@ -1175,24 +1174,22 @@ int mpc_MPI_Win_get_attr(MPI_Win win, int keyval, void *attr_val, int *flag)
case MPI_WIN_SIZE:
*flag = 1;
- *( (void **)attr_val) = (void *)low_win->size;
+ *( (void **)attr_val) = (void *)&low_win->size;
return MPI_SUCCESS;
case MPI_WIN_DISP_UNIT:
*flag = 1;
- *( (void **)attr_val) = (void *)low_win->disp_unit;
+ *( (void **)attr_val) = (void *)&low_win->disp_unit;
return MPI_SUCCESS;
case MPI_WIN_CREATE_FLAVOR:
*flag = 1;
- val = desc->flavor;
- *( (void **)attr_val) = (void *)val;
+ *( (void **)attr_val) = (void *)&desc->flavor;
return MPI_SUCCESS;
case MPI_WIN_MODEL:
*flag = 1;
- val = desc->model;
- *( (void **)attr_val) = (void *)val;
+ *( (void **)attr_val) = (void *)&desc->model;
return MPI_SUCCESS;
}
--
2.34.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment