Skip to content

Commit

Permalink
prov/sockets: remove never reached case null src_addr case
Browse files Browse the repository at this point in the history
The only path leading to this function ensures that the src address has been
properly received. Coverity complains about dereferencing a NULL since a check
exists to see if it is NULL

Signed-off-by: Alexia Ingerson <[email protected]>
  • Loading branch information
aingerson authored and j-xiong committed Nov 9, 2023
1 parent 9a89bf1 commit 4217805
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions prov/sockets/src/sock_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1511,20 +1511,13 @@ struct fi_info *sock_fi_info(uint32_t version, enum fi_ep_type ep_type,
info->src_addrlen = 0;
info->dest_addrlen = 0;

assert(src_addr);
info->src_addr = calloc(1, ofi_sizeofaddr(src_addr));
if (!info->src_addr)
goto err;

info->mode = SOCK_MODE;

if (src_addr) {
memcpy(info->src_addr, src_addr, ofi_sizeofaddr(src_addr));
} else {
sock_get_src_addr_from_hostname(info->src_addr, NULL,
dest_addr ? ((struct sockaddr *) dest_addr)->sa_family :
ofi_get_sa_family(hints));
}

memcpy(info->src_addr, src_addr, ofi_sizeofaddr(src_addr));
info->src_addrlen = ofi_sizeofaddr(info->src_addr);
if (info->src_addrlen == sizeof(struct sockaddr_in6))
info->addr_format = FI_SOCKADDR_IN6;
Expand Down

0 comments on commit 4217805

Please sign in to comment.