From b4ceb859b785c9e749ea18a1e373b697744b4116 Mon Sep 17 00:00:00 2001 From: Alexander Oganezov Date: Wed, 7 Aug 2024 22:58:06 -0700 Subject: [PATCH] DAOS-16288 cart: coverity fixes for 16287,16288,16289 (#14843) Coverity fixes for DAOS-16287,16288,16289. Signed-off-by: Alexander A Oganezov --- src/cart/crt_group.c | 2 +- src/tests/ftest/cart/test_group_np_cli.c | 4 ++-- src/tests/ftest/cart/test_no_timeout.c | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cart/crt_group.c b/src/cart/crt_group.c index b28c1c3b336..8e97959e315 100644 --- a/src/cart/crt_group.c +++ b/src/cart/crt_group.c @@ -1646,7 +1646,7 @@ crt_hdlr_uri_lookup(crt_rpc_t *rpc_req) if (rc != DER_SUCCESS) D_INFO("uri lookup of (rank=%d:tag=%d) group=%s failed; rc=%d\n", ul_in->ul_rank, - ul_in->ul_tag, grp_priv->gp_pub.cg_grpid, rc); + ul_in->ul_tag, grp_priv == NULL ? "(null)" : grp_priv->gp_pub.cg_grpid, rc); if (should_decref) crt_grp_priv_decref(grp_priv); diff --git a/src/tests/ftest/cart/test_group_np_cli.c b/src/tests/ftest/cart/test_group_np_cli.c index 4af2934afb3..f796fc1a152 100644 --- a/src/tests/ftest/cart/test_group_np_cli.c +++ b/src/tests/ftest/cart/test_group_np_cli.c @@ -127,8 +127,8 @@ test_run(void) /* avoid checkpatch warning */ d_rank_list_free(rank_list); } - rank_list = uint32_array_to_rank_list(_cg_ranks, - _cg_num_ranks); + rank_list = uint32_array_to_rank_list(_cg_ranks, _cg_num_ranks); + D_ASSERTF(rank_list != NULL, "failed to convert array to rank list\n"); } rc = crtu_wait_for_ranks(test_g.t_crt_ctx[0], diff --git a/src/tests/ftest/cart/test_no_timeout.c b/src/tests/ftest/cart/test_no_timeout.c index b5c530a73fa..d177c9554a0 100644 --- a/src/tests/ftest/cart/test_no_timeout.c +++ b/src/tests/ftest/cart/test_no_timeout.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2018-2022 Intel Corporation. + * (C) Copyright 2018-2024 Intel Corporation. * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -103,7 +103,9 @@ test_run(void) test_g.t_srv_ctx_num, 60, 120); D_ASSERTF(rc == 0, "wait_for_ranks() failed; rc=%d\n", rc); - crt_group_size(test_g.t_remote_group, &test_g.t_remote_group_size); + rc = crt_group_size(test_g.t_remote_group, &test_g.t_remote_group_size); + D_ASSERTF(rc == 0, "crt_group_size() failed; rc=%d\n", rc); + fprintf(stderr, "size of %s is %d\n", test_g.t_remote_group_name, test_g.t_remote_group_size);