Skip to content

Commit 0447ed2

Browse files
committed
net: Fix unaligned access crash with gcc 7.x in arm
The gcc 7.x is generating code for ARM that is causing memory alignment error when net_ipv6_addr_create_solicited_node() is called by IP stack. Fix this by removing the offeding UNALIGNED_PUT() calls and replacing them by simple memset(). Fixes zephyrproject-rtos#6307 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 265f502 commit 0447ed2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

include/net/net_ip.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -652,11 +652,7 @@ void net_ipv6_addr_create_solicited_node(const struct in6_addr *src,
652652
{
653653
dst->s6_addr[0] = 0xFF;
654654
dst->s6_addr[1] = 0x02;
655-
UNALIGNED_PUT(0, &dst->s6_addr16[1]);
656-
UNALIGNED_PUT(0, &dst->s6_addr16[2]);
657-
UNALIGNED_PUT(0, &dst->s6_addr16[3]);
658-
UNALIGNED_PUT(0, &dst->s6_addr16[4]);
659-
dst->s6_addr[10] = 0;
655+
memset(&dst->s6_addr[2], 0, 9);
660656
dst->s6_addr[11] = 0x01;
661657
dst->s6_addr[12] = 0xFF;
662658
dst->s6_addr[13] = src->s6_addr[13];

0 commit comments

Comments
 (0)