From 9375e8d0101e0925c76a152e7f398edfbe47cc09 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Mon, 30 May 2022 12:46:46 +0200 Subject: [PATCH] wireguard: no warning about possible alignm. issue We locally disable 'address-of-packed-member' warnings because GCC complained about possible alignment issues when returning a reference to a packed member as naturally aligned pointer (for some reason only on arm_v8a). We know that the member is aligned to NETDEV_ALIGN via __attribute__ and that the warning is therefor unnecessary. Ref #4519 --- .../app/wireguard/genode_c_api/wireguard.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/repos/dde_linux/src/app/wireguard/genode_c_api/wireguard.c b/repos/dde_linux/src/app/wireguard/genode_c_api/wireguard.c index 80647fb428..8dab6c1514 100644 --- a/repos/dde_linux/src/app/wireguard/genode_c_api/wireguard.c +++ b/repos/dde_linux/src/app/wireguard/genode_c_api/wireguard.c @@ -175,7 +175,17 @@ void genode_wg_genl_family(struct genl_family * family) struct net_device * genode_wg_net_device(void) { + /* + * We disable this warning because GCC complained about possible alignment + * issues when returning a reference to the packed member as naturally + * aligned pointer (for some reason only on arm_v8a). However, we know + * that the member is aligned to NETDEV_ALIGN and that the warning is + * therefor unnecessary. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" return &_genode_wg_net_dev.public_data; +#pragma GCC diagnostic pop } void genode_wg_udp_tunnel_sock_cfg(struct udp_tunnel_sock_cfg * cfg) @@ -229,7 +239,8 @@ _genode_wg_config_add_dev(genode_wg_u16_t listen_port, _genode_wg_net_dev.public_data.rtnl_link_ops = _genode_wg_rtnl_link_ops; _genode_wg_net_dev.pcpu_refcnt = 0; genode_wg_arch_net_dev_init( - &_genode_wg_net_dev.public_data, &_genode_wg_net_dev.pcpu_refcnt); + genode_wg_net_device(), &_genode_wg_net_dev.pcpu_refcnt); + _genode_wg_sk_buff.sk = &_genode_wg_sock; _genode_wg_sock.sk_user_data = &_genode_wg_net_dev.private_data; @@ -265,7 +276,7 @@ _genode_wg_config_add_dev(genode_wg_u16_t listen_port, /* trigger execution of 'wg_open' */ _genode_wg_net_dev.public_data.netdev_ops->ndo_open( - &_genode_wg_net_dev.public_data); + genode_wg_net_device()); } @@ -487,12 +498,12 @@ void lx_user_init(void) skb_init(); /* trigger execution of 'wg_setup' */ - _genode_wg_rtnl_link_ops->setup(&_genode_wg_net_dev.public_data); + _genode_wg_rtnl_link_ops->setup(genode_wg_net_device()); /* trigger execution of 'wg_newlink' */ _genode_wg_rtnl_link_ops->newlink( &_genode_wg_src_net, - &_genode_wg_net_dev.public_data, + genode_wg_net_device(), _genode_wg_tb, _genode_wg_data, &_genode_wg_extack);