Skip to content

Commit

Permalink
DAOS-16407 cart: coverity 2555825 fix (#14994)
Browse files Browse the repository at this point in the history
- Added explicit assert check for provider_str not being null
and removed a conditional check which confused coverity.

Signed-off-by: Alexander A Oganezov <alexander.a.oganezov@intel.com>
  • Loading branch information
frostedcmos committed Aug 26, 2024
1 parent 2da75ff commit 04c71a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cart/crt_hg.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ crt_get_info_string(bool primary, crt_provider_t provider, int iface_idx,
start_port = crt_provider_ctx0_port_get(primary, provider);
domain_str = crt_provider_domain_str_get(primary, provider, iface_idx);

D_ASSERTF(provider_str != NULL, "String for provider=%d not found\n", provider);

/* CXI provider uses domain names for info string */
if (provider == CRT_PROV_OFI_CXI)
iface_str = NULL;
Expand All @@ -690,8 +692,7 @@ crt_get_info_string(bool primary, crt_provider_t provider, int iface_idx,
D_GOTO(out, rc);
}

if (provider_str)
size += strlen(provider_str);
size = strlen(provider_str);
if (domain_str)
size += strlen(domain_str);
if (iface_str)
Expand Down

0 comments on commit 04c71a8

Please sign in to comment.