net/igmp: fix build warning on GCC 12.2.0

igmp/igmp_input.c: In function 'igmp_input':
igmp/igmp_input.c:201:31: warning: the comparison will always evaluate as 'false' for the address of 'grpaddr' will never be NULL [-Waddress]
  201 |             if (igmp->grpaddr == 0)
      |                               ^~
In file included from nuttx/include/nuttx/net/netstats.h:67,
                 from igmp/igmp_input.c:53:
nuttx/include/nuttx/net/igmp.h:132:12: note: 'grpaddr' declared here
  132 |   uint16_t grpaddr[2];       /* 32-bit Group address */
      |            ^~~~~~~

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2022-10-10 21:54:37 +08:00 committed by Xiang Xiao
parent 8e146590a9
commit 09bb292fa2

View File

@ -198,7 +198,7 @@ void igmp_input(struct net_driver_s *dev)
* Query."
*/
if (igmp->grpaddr == 0)
if (net_ipv4addr_cmp(igmp->grpaddr, INADDR_ANY) != 0)
{
FAR struct igmp_group_s *member;
@ -233,7 +233,7 @@ void igmp_input(struct net_driver_s *dev)
}
}
}
else /* if (igmp->grpaddr != 0) */
else /* if (net_ipv4addr_cmp(igmp->grpaddr, INADDR_ANY) == 0) */
{
ninfo("Group-specific multicast query\n");
@ -262,7 +262,7 @@ void igmp_input(struct net_driver_s *dev)
/* Not sent to all systems -- Unicast query */
else if (group->grpaddr != 0)
else if (net_ipv4addr_cmp(igmp->grpaddr, INADDR_ANY) == 0)
{
ninfo("Unicast query\n");
IGMP_STATINCR(g_netstats.igmp.ucast_query);