Skip to content

Commit 5bbc591

Browse files
authored
Merge pull request #11208 from drwootton/spml_ucx_init_err
Fix uninitialized pointer in mca_smpl_ucx_register: Coverity CID 1498717
2 parents 1ea2801 + 64a8d74 commit 5bbc591

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
689689
{
690690
sshmem_mkey_t *mkeys;
691691
ucs_status_t status;
692-
spml_ucx_mkey_t *ucx_mkey;
692+
spml_ucx_mkey_t *ucx_mkey = NULL;
693693
size_t len;
694694
ucp_mem_map_params_t mem_map_params;
695695
uint32_t segno;
@@ -740,7 +740,7 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
740740
status = ucp_rkey_pack(mca_spml_ucx.ucp_context, mem_h,
741741
&mkeys[SPML_UCX_TRANSP_IDX].u.data, &len);
742742
if (UCS_OK != status) {
743-
goto error_unmap;
743+
goto error_out;
744744
}
745745
if (len >= 0xffff) {
746746
SPML_UCX_ERROR("packed rkey is too long: %llu >= %d",
@@ -761,7 +761,9 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
761761
return mkeys;
762762

763763
error_unmap:
764-
ucp_mem_unmap(mca_spml_ucx.ucp_context, ucx_mkey->mem_h);
764+
if (NULL != ucx_mkey) {
765+
ucp_mem_unmap(mca_spml_ucx.ucp_context, ucx_mkey->mem_h);
766+
}
765767
error_out:
766768
free(mkeys);
767769

0 commit comments

Comments
 (0)