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,17 +194,14 @@ 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) {
|
||||
/* 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) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
if (NULL != results && 0 < (op->ninfo = opal_list_get_size(results))) {
|
||||
/* convert the list of results to an array of info */
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
/* convert the status */
|
||||
@ -815,14 +812,17 @@ 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);
|
||||
PMIX_INFO_CREATE(info, v->data.darray->size);
|
||||
v->data.darray->array = info;
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(val, list, opal_value_t) {
|
||||
(void)strncpy(info[n].key, val->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&info[n].value, val);
|
||||
++n;
|
||||
}
|
||||
if (0 < v->data.darray->size) {
|
||||
PMIX_INFO_CREATE(info, v->data.darray->size);
|
||||
v->data.darray->array = info;
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(val, list, opal_value_t) {
|
||||
(void)strncpy(info[n].key, val->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&info[n].value, val);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
v->data.darray->array = NULL;
|
||||
break;
|
||||
default:
|
||||
/* silence warnings */
|
||||
@ -1066,16 +1066,13 @@ 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) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
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) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1180,16 +1177,13 @@ 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) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
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) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -921,15 +921,12 @@ 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) {
|
||||
PMIX_INFO_CREATE(pcaddy->info, pcaddy->ninfo);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(pcaddy->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&pcaddy->info[n].value, kv);
|
||||
}
|
||||
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) {
|
||||
(void)strncpy(pcaddy->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&pcaddy->info[n].value, kv);
|
||||
}
|
||||
}
|
||||
/* we are done with the incoming data */
|
||||
|
@ -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 */
|
||||
sz = 2 + ((NULL==info)?0:opal_list_get_size(info));
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info) + 2;
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
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,16 +271,18 @@ 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);
|
||||
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;
|
||||
pinfo[n].value.data.darray->array = (struct pmix_info_t*)pmap;
|
||||
pinfo[n].value.data.darray->size = szmap;
|
||||
m = 0;
|
||||
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
|
||||
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&pmap[m].value, k2);
|
||||
++m;
|
||||
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;
|
||||
pinfo[n].value.data.darray->array = (struct pmix_info_t*)pmap;
|
||||
pinfo[n].value.data.darray->size = szmap;
|
||||
m = 0;
|
||||
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
|
||||
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&pmap[m].value, k2);
|
||||
++m;
|
||||
}
|
||||
}
|
||||
OPAL_LIST_RELEASE(pmapinfo);
|
||||
} else {
|
||||
@ -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) {
|
||||
/* convert the list of results to an array of info */
|
||||
op->ninfo = opal_list_get_size(results);
|
||||
if (NULL != results && 0 < (op->ninfo = opal_list_get_size(results))) {
|
||||
/* convert the list of results to an array of info */
|
||||
if (0 < op->ninfo) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
@ -815,13 +814,17 @@ 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);
|
||||
PMIX_INFO_CREATE(info, v->data.darray->size);
|
||||
v->data.darray->array = info;
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(val, list, opal_value_t) {
|
||||
(void)strncpy(info[n].key, val->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&info[n].value, val);
|
||||
++n;
|
||||
if (0 < v->data.darray->size) {
|
||||
PMIX_INFO_CREATE(info, v->data.darray->size);
|
||||
v->data.darray->array = info;
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(val, list, opal_value_t) {
|
||||
(void)strncpy(info[n].key, val->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&info[n].value, val);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
v->data.darray->array = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -1066,16 +1069,13 @@ 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) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
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) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1180,16 +1180,13 @@ 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) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
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) {
|
||||
(void)strncpy(op->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&op->info[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -921,15 +921,12 @@ 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) {
|
||||
PMIX_INFO_CREATE(pcaddy->info, pcaddy->ninfo);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(pcaddy->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&pcaddy->info[n].value, kv);
|
||||
}
|
||||
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) {
|
||||
(void)strncpy(pcaddy->info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&pcaddy->info[n].value, kv);
|
||||
}
|
||||
}
|
||||
/* we are done with the incoming data */
|
||||
|
@ -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 */
|
||||
sz = 2 + ((NULL==info)?0:opal_list_get_size(info));
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info) + 2;
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
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,16 +276,18 @@ 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);
|
||||
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;
|
||||
pinfo[n].value.data.darray->array = (struct pmix_info_t*)pmap;
|
||||
pinfo[n].value.data.darray->size = szmap;
|
||||
m = 0;
|
||||
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
|
||||
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&pmap[m].value, k2);
|
||||
++m;
|
||||
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;
|
||||
pinfo[n].value.data.darray->array = (struct pmix_info_t*)pmap;
|
||||
pinfo[n].value.data.darray->size = szmap;
|
||||
m = 0;
|
||||
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
|
||||
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&pmap[m].value, k2);
|
||||
++m;
|
||||
}
|
||||
}
|
||||
OPAL_LIST_RELEASE(pmapinfo);
|
||||
} else {
|
||||
@ -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