From 571c46253f49cfe228b6fd8dd7cf81439a3aee28 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Mon, 17 Mar 2025 12:27:40 +0700 Subject: [PATCH] src/core: fix gcc analyzer warning Make ip4_addr_isany check first to avoid warning: "check of 'ipaddr' for NULL after already dereferencing it [-Werror=analyzer-deref-before-check]" --- src/core/ipv4/etharp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c index 3092dc94..5f63b543 100644 --- a/src/core/ipv4/etharp.c +++ b/src/core/ipv4/etharp.c @@ -940,9 +940,9 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q) netif_addr_idx_t i; /* non-unicast address? */ - if (ip4_addr_isbroadcast(ipaddr, netif) || - ip4_addr_ismulticast(ipaddr) || - ip4_addr_isany(ipaddr)) { + if (ip4_addr_isany(ipaddr) || + ip4_addr_isbroadcast(ipaddr, netif) || + ip4_addr_ismulticast(ipaddr)) { LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: will not add non-unicast IP address to ARP cache\n")); return ERR_ARG; }