From 8bf63c5ec761a34c5e9f51b8265900e0f3455da9 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Fri, 4 Aug 2017 19:06:49 +0000 Subject: [PATCH] tests: fix unaligned access in nlattr_packet_diag_msg.test * tests/nlattr_packet_diag_msg.c (init_packet_diag_msg): Use SET_STRUCT to initialize potentially unaligned struct packet_diag_msg. --- tests/nlattr_packet_diag_msg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/nlattr_packet_diag_msg.c b/tests/nlattr_packet_diag_msg.c index a80c00c8..55b4144d 100644 --- a/tests/nlattr_packet_diag_msg.c +++ b/tests/nlattr_packet_diag_msg.c @@ -55,10 +55,10 @@ init_packet_diag_msg(struct nlmsghdr *const nlh, const unsigned int msg_len) ); struct packet_diag_msg *const msg = NLMSG_DATA(nlh); - *msg = (struct packet_diag_msg) { + SET_STRUCT(struct packet_diag_msg, msg, .pdiag_family = AF_PACKET, .pdiag_type = SOCK_STREAM - }; + ); } static void -- 2.40.0