From: Dmitry V. Levin Date: Fri, 4 Aug 2017 19:06:49 +0000 (+0000) Subject: tests: fix unaligned access in nlattr_packet_diag_msg.test X-Git-Tag: v4.19~183 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8bf63c5ec761a34c5e9f51b8265900e0f3455da9;p=strace 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. --- 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