From 26b2796355d7114f28feadfdb0f6b29fbc951c7d Mon Sep 17 00:00:00 2001 From: Ken Raffenetti Date: Mon, 16 Dec 2024 11:31:41 -0600 Subject: [PATCH] pm/hydra: Fix error checking for some libpmi functions libpmi functions return a pmi_errno, not a HYD_status. Make sure to capture the value in the right variable type and perform the necessary check on it. --- src/pm/hydra/mpiexec/pmiserv_cb.c | 5 +++-- src/pm/hydra/proxy/pmip_cb.c | 8 ++++---- src/pm/hydra/proxy/pmip_pmi.c | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/pm/hydra/mpiexec/pmiserv_cb.c b/src/pm/hydra/mpiexec/pmiserv_cb.c index 563c8b61dae..1b24dc683be 100644 --- a/src/pm/hydra/mpiexec/pmiserv_cb.c +++ b/src/pm/hydra/mpiexec/pmiserv_cb.c @@ -46,6 +46,7 @@ static HYD_status handle_pmi_cmd(struct HYD_proxy *proxy, int pgid, int process_ int buflen, int pmi_version) { HYD_status status = HYD_SUCCESS; + int pmi_errno; HYDU_FUNC_ENTER(); @@ -53,8 +54,8 @@ static HYD_status handle_pmi_cmd(struct HYD_proxy *proxy, int pgid, int process_ HYDU_dump(stdout, "[pgid: %d] got PMI command: %s\n", pgid, buf); struct PMIU_cmd pmi; - status = PMIU_cmd_parse(buf, buflen, pmi_version, &pmi); - HYDU_ERR_POP(status, "unable to parse PMI command\n"); + pmi_errno = PMIU_cmd_parse(buf, buflen, pmi_version, &pmi); + HYDU_ASSERT(!pmi_errno, status); #if defined ENABLE_PROFILING if (HYD_server_info.enable_profiling) diff --git a/src/pm/hydra/proxy/pmip_cb.c b/src/pm/hydra/proxy/pmip_cb.c index 2a209a776d3..0457d02d4db 100644 --- a/src/pm/hydra/proxy/pmip_cb.c +++ b/src/pm/hydra/proxy/pmip_cb.c @@ -154,8 +154,8 @@ static HYD_status handle_pmi_cmd(struct pmip_downstream *p, char *buf, int bufle if (handler) { struct PMIU_cmd pmi; - status = PMIU_cmd_parse(buf, buflen, pmi_version, &pmi); - HYDU_ERR_POP(status, "unable to parse PMI command\n"); + int pmi_errno = PMIU_cmd_parse(buf, buflen, pmi_version, &pmi); + HYDU_ASSERT(!pmi_errno, status); if (HYD_pmcd_pmip.user_global.debug) { int pgid = PMIP_pg_from_downstream(p)->pgid; @@ -414,8 +414,8 @@ static HYD_status handle_pmi_response(struct pmip_pg *pg, int buflen, int pmi_ve if (handler) { struct PMIU_cmd pmi; /* note: buf is modified during parsing; make sure do not forward */ - status = PMIU_cmd_parse(buf, buflen, pmi_version, &pmi); - HYDU_ERR_POP(status, "unable to parse PMI command\n"); + int pmi_errno = PMIU_cmd_parse(buf, buflen, pmi_version, &pmi); + HYDU_ASSERT(!pmi_errno, status); status = handler(pg, &pmi); HYDU_ERR_POP(status, "PMI handler returned error\n"); diff --git a/src/pm/hydra/proxy/pmip_pmi.c b/src/pm/hydra/proxy/pmip_pmi.c index d4d1f2afd4a..0e077d271d8 100644 --- a/src/pm/hydra/proxy/pmip_pmi.c +++ b/src/pm/hydra/proxy/pmip_pmi.c @@ -485,8 +485,8 @@ HYD_status fn_put(struct pmip_downstream *p, struct PMIU_cmd *pmi) HYDU_ASSERT(!pmi_errno, status); if (strncmp(key, "PMI_", 4) == 0) { - status = PMIU_msg_set_response_fail(pmi, &pmi_response, is_static, - 1, "Keys with PMI_ prefix are reserved"); + pmi_errno = PMIU_msg_set_response_fail(pmi, &pmi_response, is_static, + 1, "Keys with PMI_ prefix are reserved"); HYDU_ASSERT(!pmi_errno, status); status = send_cmd_downstream(p->pmi_fd, &pmi_response); @@ -662,8 +662,8 @@ HYD_status fn_info_putnodeattr(struct pmip_downstream *p, struct PMIU_cmd *pmi) HYDU_ASSERT(!pmi_errno, status); if (strncmp(key, "PMI_", 4) == 0) { - status = PMIU_msg_set_response_fail(pmi, &pmi_response, is_static, - 1, "Keys with PMI_ prefix are reserved"); + pmi_errno = PMIU_msg_set_response_fail(pmi, &pmi_response, is_static, + 1, "Keys with PMI_ prefix are reserved"); HYDU_ASSERT(!pmi_errno, status); status = send_cmd_downstream(p->pmi_fd, &pmi_response);