]> git.ipfire.org Git - thirdparty/openvpn.git/commit
sitnl: replace NLMSG_TAIL macro with noinline function
authorAntonio Quartulli <antonio@mandelbit.com>
Wed, 6 Nov 2024 13:17:03 +0000 (14:17 +0100)
committerGert Doering <gert@greenie.muc.de>
Sat, 9 Nov 2024 11:23:14 +0000 (12:23 +0100)
commit648e1606496adc6ec37a9d862810e465dab64dc0
tree5b2991cd751c7384e15fd46421b8ffc67952d2cf
parent7f0214c9e2ca2991bd8affd5754bf9286b904bf7
sitnl: replace NLMSG_TAIL macro with noinline function

The NLMSG_TAIL macro is confusing gcc when compiling with -O3, leading
to warnings like:

networking_sitnl.c:143:9: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=]
  143 |         memcpy(RTA_DATA(rta), data, alen);
      |         ^
networking_sitnl.c:101:21: note: at offset [72, 88] into destination object ā€˜n’ of size 16
  101 |     struct nlmsghdr n;
      |                     ^

Replacing the macro with a function is also not effective because gcc
will inline it and get confused again.

The only way out is to write a function that never gets inline'd and
replace the macro with it.

Tested on linux with gcc and clang.

Change-Id: I9306a590a10a7d5cba32abe06d269494fec41ba6
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20241106131705.11069-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29710.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/networking_sitnl.c