lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [PATCH] Fix aliasing violation.


From: David Woodhouse
Subject: [lwip-devel] [PATCH] Fix aliasing violation.
Date: Fri, 03 Oct 2008 10:43:27 +0100

src/netif/etharp.c: In function ‘etharp_arp_input’:
src/netif/etharp.c:708: warning: dereferencing type-punned pointer will break 
strict-aliasing rules

Index: src/netif/etharp.c
===================================================================
RCS file: /sources/lwip/lwip/src/netif/etharp.c,v
retrieving revision 1.148
diff -u -p -r1.148 etharp.c
--- src/netif/etharp.c  19 Jun 2008 16:40:59 -0000      1.148
+++ src/netif/etharp.c  3 Oct 2008 09:39:55 -0000
@@ -705,7 +705,7 @@ etharp_arp_input(struct netif *netif, st
       hdr->opcode = htons(ARP_REPLY);
 
       hdr->dipaddr = hdr->sipaddr;
-      hdr->sipaddr = *(struct ip_addr2 *)&netif->ip_addr;
+      memcpy(&hdr->sipaddr, &netif->ip_addr, sizeof(hdr->sipaddr));
 
       LWIP_ASSERT("netif->hwaddr_len must be the same as ETHARP_HWADDR_LEN for 
etharp!",
                   (netif->hwaddr_len == ETHARP_HWADDR_LEN));

-- 
David Woodhouse                            Open Source Technology Centre
address@hidden                              Intel Corporation





reply via email to

[Prev in Thread] Current Thread [Next in Thread]