pmix: do not invoke PMIX_INFO_CREATE() with a zero size
Thanks Lisandro Dalcin for the report Fixes open-mpi/ompi#3854 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
ad87aa2674
Коммит
fd08b923d5
@ -194,10 +194,8 @@ static void return_local_event_hdlr(int status, opal_list_t *results,
|
||||
if (NULL != cd->pmixcbfunc) {
|
||||
op = OBJ_NEW(ext2x_opcaddy_t);
|
||||
|
||||
if (NULL != results) {
|
||||
if (NULL != results && 0 < (op->ninfo = opal_list_get_size(results))) {
|
||||
/* convert the list of results to an array of info */
|
||||
op->ninfo = opal_list_get_size(results);
|
||||
if (0 < op->ninfo) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) {
|
||||
@ -206,7 +204,6 @@ static void return_local_event_hdlr(int status, opal_list_t *results,
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* convert the status */
|
||||
pstatus = ext2x_convert_opalrc(status);
|
||||
/* call the library's callback function */
|
||||
@ -815,6 +812,7 @@ void ext2x_value_load(pmix_value_t *v,
|
||||
v->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t));
|
||||
v->data.darray->type = PMIX_INFO;
|
||||
v->data.darray->size = opal_list_get_size(list);
|
||||
if (0 < v->data.darray->size) {
|
||||
PMIX_INFO_CREATE(info, v->data.darray->size);
|
||||
v->data.darray->array = info;
|
||||
n=0;
|
||||
@ -823,6 +821,8 @@ void ext2x_value_load(pmix_value_t *v,
|
||||
ext2x_value_load(&info[n].value, val);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
v->data.darray->array = NULL;
|
||||
break;
|
||||
default:
|
||||
/* silence warnings */
|
||||
@ -1066,9 +1066,7 @@ static void register_handler(opal_list_t *event_codes,
|
||||
}
|
||||
|
||||
/* convert the list of info to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
op->ninfo = opal_list_get_size(info);
|
||||
if (0 < op->ninfo) {
|
||||
if (NULL != info && 0 < (op->ninfo = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -1077,7 +1075,6 @@ static void register_handler(opal_list_t *event_codes,
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* register the event */
|
||||
op->event = OBJ_NEW(opal_ext2x_event_t);
|
||||
@ -1180,9 +1177,7 @@ static int notify_event(int status,
|
||||
prange = ext2x_convert_opalrange(range);
|
||||
|
||||
/* convert the list of info */
|
||||
if (NULL != info) {
|
||||
op->ninfo = opal_list_get_size(info);
|
||||
if (0 < op->ninfo) {
|
||||
if (NULL != info && 0 < (op->ninfo = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -1191,7 +1186,6 @@ static int notify_event(int status,
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ask the library to notify our clients */
|
||||
pstatus = PMIx_Notify_event(pstatus, pptr, prange, op->info, op->ninfo, notify_complete, op);
|
||||
|
@ -921,9 +921,7 @@ static void info_cbfunc(int status,
|
||||
pcaddy->status = ext2x_convert_opalrc(status);
|
||||
|
||||
/* convert the list to a pmix_info_t array */
|
||||
if (NULL != info) {
|
||||
pcaddy->ninfo = opal_list_get_size(info);
|
||||
if (0 < pcaddy->ninfo) {
|
||||
if (NULL != info && 0 < (pcaddy->ninfo = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(pcaddy->info, pcaddy->ninfo);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -931,7 +929,6 @@ static void info_cbfunc(int status,
|
||||
ext2x_value_load(&pcaddy->info[n].value, kv);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* we are done with the incoming data */
|
||||
if (NULL != release_fn) {
|
||||
release_fn(release_cbdata);
|
||||
|
@ -112,18 +112,15 @@ int ext2x_server_init(opal_pmix_server_module_t *module,
|
||||
++opal_pmix_base.initialized;
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info) + 2;
|
||||
sz = 2 + ((NULL==info)?0:opal_list_get_size(info));
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
if (NULL != info) {
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&pinfo[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
sz = 2;
|
||||
PMIX_INFO_CREATE(pinfo, 2);
|
||||
}
|
||||
|
||||
/* insert ourselves into our list of jobids - it will be the
|
||||
@ -263,8 +260,7 @@ int ext2x_server_register_nspace(opal_jobid_t jobid,
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info);
|
||||
if (NULL != info && 0 < (sz = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -275,6 +271,7 @@ int ext2x_server_register_nspace(opal_jobid_t jobid,
|
||||
* that list to another array */
|
||||
pmapinfo = (opal_list_t*)kv->data.ptr;
|
||||
szmap = opal_list_get_size(pmapinfo);
|
||||
if (0 < szmap) {
|
||||
PMIX_INFO_CREATE(pmap, szmap);
|
||||
pinfo[n].value.data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t));
|
||||
pinfo[n].value.data.darray->type = PMIX_INFO;
|
||||
@ -286,6 +283,7 @@ int ext2x_server_register_nspace(opal_jobid_t jobid,
|
||||
ext2x_value_load(&pmap[m].value, k2);
|
||||
++m;
|
||||
}
|
||||
}
|
||||
OPAL_LIST_RELEASE(pmapinfo);
|
||||
} else {
|
||||
ext2x_value_load(&pinfo[n].value, kv);
|
||||
@ -515,8 +513,7 @@ int ext2x_server_notify_event(int status,
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info);
|
||||
if (NULL != info && 0 < (sz = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
|
@ -194,9 +194,8 @@ static void return_local_event_hdlr(int status, opal_list_t *results,
|
||||
if (NULL != cd->pmixcbfunc) {
|
||||
op = OBJ_NEW(pmix2x_opcaddy_t);
|
||||
|
||||
if (NULL != results) {
|
||||
if (NULL != results && 0 < (op->ninfo = opal_list_get_size(results))) {
|
||||
/* convert the list of results to an array of info */
|
||||
op->ninfo = opal_list_get_size(results);
|
||||
if (0 < op->ninfo) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
@ -815,6 +814,7 @@ void pmix2x_value_load(pmix_value_t *v,
|
||||
v->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t));
|
||||
v->data.darray->type = PMIX_INFO;
|
||||
v->data.darray->size = opal_list_get_size(list);
|
||||
if (0 < v->data.darray->size) {
|
||||
PMIX_INFO_CREATE(info, v->data.darray->size);
|
||||
v->data.darray->array = info;
|
||||
n=0;
|
||||
@ -823,6 +823,9 @@ void pmix2x_value_load(pmix_value_t *v,
|
||||
pmix2x_value_load(&info[n].value, val);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
v->data.darray->array = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* silence warnings */
|
||||
@ -1066,9 +1069,7 @@ static void register_handler(opal_list_t *event_codes,
|
||||
}
|
||||
|
||||
/* convert the list of info to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
op->ninfo = opal_list_get_size(info);
|
||||
if (0 < op->ninfo) {
|
||||
if (NULL != info && 0 < (op->ninfo = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -1077,7 +1078,6 @@ static void register_handler(opal_list_t *event_codes,
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* register the event */
|
||||
op->event = OBJ_NEW(opal_pmix2x_event_t);
|
||||
@ -1180,9 +1180,7 @@ static int notify_event(int status,
|
||||
prange = pmix2x_convert_opalrange(range);
|
||||
|
||||
/* convert the list of info */
|
||||
if (NULL != info) {
|
||||
op->ninfo = opal_list_get_size(info);
|
||||
if (0 < op->ninfo) {
|
||||
if (NULL != info && 0 < (op->ninfo = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -1191,7 +1189,6 @@ static int notify_event(int status,
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ask the library to notify our clients */
|
||||
pstatus = PMIx_Notify_event(pstatus, pptr, prange, op->info, op->ninfo, notify_complete, op);
|
||||
|
@ -921,9 +921,7 @@ static void info_cbfunc(int status,
|
||||
pcaddy->status = pmix2x_convert_opalrc(status);
|
||||
|
||||
/* convert the list to a pmix_info_t array */
|
||||
if (NULL != info) {
|
||||
pcaddy->ninfo = opal_list_get_size(info);
|
||||
if (0 < pcaddy->ninfo) {
|
||||
if (NULL != info && 0 < (pcaddy->ninfo = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(pcaddy->info, pcaddy->ninfo);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -931,7 +929,6 @@ static void info_cbfunc(int status,
|
||||
pmix2x_value_load(&pcaddy->info[n].value, kv);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* we are done with the incoming data */
|
||||
if (NULL != release_fn) {
|
||||
release_fn(release_cbdata);
|
||||
|
@ -117,18 +117,15 @@ int pmix2x_server_init(opal_pmix_server_module_t *module,
|
||||
++opal_pmix_base.initialized;
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info) + 2;
|
||||
sz = 2 + ((NULL==info)?0:opal_list_get_size(info));
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
if (NULL != info) {
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&pinfo[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
sz = 2;
|
||||
PMIX_INFO_CREATE(pinfo, 2);
|
||||
}
|
||||
|
||||
/* insert ourselves into our list of jobids - it will be the
|
||||
@ -268,8 +265,7 @@ int pmix2x_server_register_nspace(opal_jobid_t jobid,
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info);
|
||||
if (NULL != info && 0 < (sz = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -280,6 +276,7 @@ int pmix2x_server_register_nspace(opal_jobid_t jobid,
|
||||
* that list to another array */
|
||||
pmapinfo = (opal_list_t*)kv->data.ptr;
|
||||
szmap = opal_list_get_size(pmapinfo);
|
||||
if (0 < szmap) {
|
||||
PMIX_INFO_CREATE(pmap, szmap);
|
||||
pinfo[n].value.data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t));
|
||||
pinfo[n].value.data.darray->type = PMIX_INFO;
|
||||
@ -291,6 +288,7 @@ int pmix2x_server_register_nspace(opal_jobid_t jobid,
|
||||
pmix2x_value_load(&pmap[m].value, k2);
|
||||
++m;
|
||||
}
|
||||
}
|
||||
OPAL_LIST_RELEASE(pmapinfo);
|
||||
} else {
|
||||
pmix2x_value_load(&pinfo[n].value, kv);
|
||||
@ -520,8 +518,7 @@ int pmix2x_server_notify_event(int status,
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info);
|
||||
if (NULL != info && 0 < (sz = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user