lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL+tcoANtVUp=tFD=JgR34_TvmrKVr7zz8gZMgoTKNDnjCzLTg@mail.gmail.com>
Date: Mon, 27 Oct 2025 15:33:43 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
Cc: Steffen Klassert <steffen.klassert@...unet.com>, Herbert Xu <herbert@...dor.apana.org.au>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, 
	Shuah Khan <shuah@...nel.org>, Willem de Bruijn <willemdebruijn.kernel@...il.com>, 
	Jason Xing <kernelxing@...cent.com>, netdev@...r.kernel.org, 
	linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH v2] selftest: net: fix variable sized type issue not at
 the end of a struct

On Mon, Oct 27, 2025 at 1:32 PM Ankit Khushwaha
<ankitkhushwaha.linux@...il.com> wrote:
>
> Some network selftests defined variable-sized types variable at the middle
> of struct causing -Wgnu-variable-sized-type-not-at-end warning.
>
> warning:
> timestamping.c:285:18: warning: field 'cm' with variable sized type
> 'struct cmsghdr' not at the end of a struct or class is a GNU
> extension [-Wgnu-variable-sized-type-not-at-end]
>   285 |                 struct cmsghdr cm;
>       |                                ^
>
> ipsec.c:835:5: warning: field 'u' with variable sized type 'union
> (unnamed union at ipsec.c:831:3)' not at the end of a struct or class
> is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
>   835 |                 } u;
>       |                   ^
>
> This patch move these field at the end of struct to fix these warnings.
>
> Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
> ---
> Changelog:
> v2: https://lore.kernel.org/linux-kselftest/20251027050856.30270-1-ankitkhushwaha.linux@gmail.com/
> - fixed typos in the commit msg.
>
> ---
>  tools/testing/selftests/net/ipsec.c        | 2 +-
>  tools/testing/selftests/net/timestamping.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/net/ipsec.c b/tools/testing/selftests/net/ipsec.c
> index 0ccf484b1d9d..36083c8f884f 100644
> --- a/tools/testing/selftests/net/ipsec.c
> +++ b/tools/testing/selftests/net/ipsec.c
> @@ -828,12 +828,12 @@ static int xfrm_state_pack_algo(struct nlmsghdr *nh, size_t req_sz,
>                 struct xfrm_desc *desc)
>  {
>         struct {
> +               char buf[XFRM_ALGO_KEY_BUF_SIZE];
>                 union {
>                         struct xfrm_algo        alg;
>                         struct xfrm_algo_aead   aead;
>                         struct xfrm_algo_auth   auth;
>                 } u;
> -               char buf[XFRM_ALGO_KEY_BUF_SIZE];
>         } alg = {};
>         size_t alen, elen, clen, aelen;
>         unsigned short type;
> diff --git a/tools/testing/selftests/net/timestamping.c b/tools/testing/selftests/net/timestamping.c
> index 044bc0e9ed81..ad2be2143698 100644
> --- a/tools/testing/selftests/net/timestamping.c
> +++ b/tools/testing/selftests/net/timestamping.c
> @@ -282,8 +282,8 @@ static void recvpacket(int sock, int recvmsg_flags,
>         struct iovec entry;
>         struct sockaddr_in from_addr;
>         struct {
> -               struct cmsghdr cm;
>                 char control[512];
> +               struct cmsghdr cm;
>         } control;
>         int res;

For the timestamping part:

Reviewed-by: Jason Xing <kerneljasonxing@...il.com>

Thanks,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ