netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Warnings build iproute2 with gcc-12 in xfrm
@ 2022-05-20 19:19 Stephen Hemminger
  0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2022-05-20 19:19 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu, David S. Miller; +Cc: netdev

Iproute2 now gets warning in xfrm code with Gcc-12

In function ‘xfrm_algo_parse’,
    inlined from ‘xfrm_state_modify.constprop’ at xfrm_state.c:573:5:
xfrm_state.c:162:32: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  162 |                         buf[j] = val;
      |                         ~~~~~~~^~~~~


Fixing it properly would be hard since buf points to element in alg union which can be from xfrm.h.
I.e:

struct xfrm_algo {
	char		alg_name[64];
	unsigned int	alg_key_len;    /* in bits */
	char		alg_key[0];
};

Looks like use of legacy zero sized arrays in uapi is the underlying root cause.

Any good suggestions on best fix here?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-20 19:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-20 19:19 Warnings build iproute2 with gcc-12 in xfrm Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).