From 5e383c26791672ef00757002856b0ba0ad579e2f Mon Sep 17 00:00:00 2001 From: Alexia Ingerson Date: Wed, 8 Nov 2023 15:26:54 -0800 Subject: [PATCH] prov/sockets: remove never reached case null src_addr case 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 --- prov/sockets/src/sock_ep.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/prov/sockets/src/sock_ep.c b/prov/sockets/src/sock_ep.c index d3f6ad82335..339d4d8baea 100644 --- a/prov/sockets/src/sock_ep.c +++ b/prov/sockets/src/sock_ep.c @@ -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;