Skip to content

Commit 49a64f7

Browse files
authored
Merge pull request open-mpi#11980 from roiedanino/bugfix/segfault-mca-tls-devices
OPAL/MCA/COMMON/UCX: added a NULL check for tls and devices
2 parents 2fd8c21 + 6bda9c1 commit 49a64f7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

opal/mca/common/ucx/common_ucx.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,30 +90,26 @@ OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *
9090
*opal_common_ucx.tls = strdup(default_tls);
9191
}
9292

93-
tls_index = mca_base_component_var_register(
94-
component, "tls",
93+
tls_index = mca_base_var_register(
94+
"opal", "opal_common", "ucx", "tls",
9595
"List of UCX transports which should be supported on the system, to enable "
9696
"selecting the UCX component. Special values: any (any available). "
9797
"A '^' prefix negates the list. "
9898
"For example, in order to exclude on shared memory and TCP transports, "
9999
"please set to '^posix,sysv,self,tcp,cma,knem,xpmem'.",
100-
MCA_BASE_VAR_TYPE_STRING, NULL, 0,
101-
MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3,
102-
MCA_BASE_VAR_SCOPE_LOCAL,
103-
opal_common_ucx.tls);
100+
MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE | MCA_BASE_VAR_FLAG_DWG,
101+
OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_LOCAL, opal_common_ucx.tls);
104102

105103
if (NULL == opal_common_ucx.devices) {
106-
opal_common_ucx.devices = (char **) malloc(sizeof(char *));
104+
opal_common_ucx.devices = (char**) malloc(sizeof(char*));
107105
*opal_common_ucx.devices = strdup(default_devices);
108106
}
109-
devices_index = mca_base_component_var_register(
110-
component, "devices",
107+
devices_index = mca_base_var_register(
108+
"opal", "opal_common", "ucx", "devices",
111109
"List of device driver pattern names, which, if supported by UCX, will "
112110
"bump its priority above ob1. Special values: any (any available)",
113-
MCA_BASE_VAR_TYPE_STRING, NULL, 0,
114-
MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3,
115-
MCA_BASE_VAR_SCOPE_LOCAL,
116-
opal_common_ucx.devices);
111+
MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE | MCA_BASE_VAR_FLAG_DWG,
112+
OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_LOCAL, opal_common_ucx.devices);
117113

118114
if (component) {
119115
mca_base_var_register_synonym(verbose_index, component->mca_project_name,
@@ -245,6 +241,10 @@ OPAL_DECLSPEC opal_common_ucx_support_level_t opal_common_ucx_support_level(ucp_
245241
int ret;
246242
#endif
247243

244+
if ((*opal_common_ucx.tls == NULL) || (*opal_common_ucx.devices == NULL)) {
245+
opal_common_ucx_mca_var_register(NULL);
246+
}
247+
248248
is_any_tl = !strcmp(*opal_common_ucx.tls, "any");
249249
is_any_device = !strcmp(*opal_common_ucx.devices, "any");
250250

0 commit comments

Comments
 (0)