From 705e776776ad38d5765c626a0729413eda9ac604 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 19 May 2022 13:11:18 +0200 Subject: [PATCH] glib-aux: fix static assertion for alignment of NMIPAddr for m68k On m68k, 32-bit integers are 2-byte aligned, causing the assertion to fail. Relax the check, it's good enough still. --- src/libnm-glib-aux/nm-shared-utils.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c index b8102cc8bc..f7ee4caeaa 100644 --- a/src/libnm-glib-aux/nm-shared-utils.c +++ b/src/libnm-glib-aux/nm-shared-utils.c @@ -37,12 +37,12 @@ const void *const _NM_PTRARRAY_EMPTY[1] = {NULL}; const NMIPAddr nm_ip_addr_zero = {}; -/* We use _nm_alignas(NMIPAddr). Ensure that this struct has the same - * alignment as in_addr_t and struct in6_addr. */ -G_STATIC_ASSERT(_nm_alignof(NMIPAddr) == 4); -G_STATIC_ASSERT(_nm_alignof(in_addr_t) == 4); -G_STATIC_ASSERT(_nm_alignof(struct in_addr) == 4); -G_STATIC_ASSERT(_nm_alignof(struct in6_addr) == 4); +/* We use _nm_alignas(NMIPAddr) to ensure that fields for in_addr_t and + * struct in6_addr have all the same alignment. Ensure that this is suitable. */ +G_STATIC_ASSERT(_nm_alignof(in_addr_t) <= _nm_alignof(NMIPAddr)); +G_STATIC_ASSERT(_nm_alignof(struct in_addr) <= _nm_alignof(NMIPAddr)); +G_STATIC_ASSERT(_nm_alignof(struct in6_addr) <= _nm_alignof(NMIPAddr)); +G_STATIC_ASSERT(_nm_alignof(NMEtherAddr) <= _nm_alignof(NMIPAddr)); /* this initializes a struct in_addr/in6_addr and allows for untrusted * arguments (like unsuitable @addr_family or @src_len). It's almost safe