drivers: wifi: simplelink: fix Coverity issue in getaddrinfo()

Check for case where host == NULL but service != NULL
could have resulted later in a NULL dereference.

Coverity-CID: 189516
Fixes #11090

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
This commit is contained in:
Gil Pitney 2018-11-07 17:42:01 -08:00 committed by Jukka Rissanen
commit 508c941d32

View file

@ -518,7 +518,7 @@ exit:
/* /*
* Later SimpleLink SDK versions implement the full getaddrinfo semantics, * Later SimpleLink SDK versions implement the full getaddrinfo semantics,
* returning potentially multiple IP addresses. * returning potentially multiple IP addresses.
* This version implements a simple gethostbyname() API. * This version implements a simple gethostbyname() API for client only.
*/ */
static int simplelink_getaddrinfo(const char *node, const char *service, static int simplelink_getaddrinfo(const char *node, const char *service,
const struct addrinfo *hints, const struct addrinfo *hints,
@ -534,7 +534,7 @@ static int simplelink_getaddrinfo(const char *node, const char *service,
_u32 ipaddr[4]; _u32 ipaddr[4];
/* Check args: */ /* Check args: */
if (!node && !service) { if (!node) {
retval = EAI_NONAME; retval = EAI_NONAME;
goto exit; goto exit;
} }