Re: [PATCH][next] nfp: Avoid -Wflex-array-member-not-at-end warnings

From: Jakub Kicinski
Date: Tue Apr 02 2024 - 00:24:40 EST


On Thu, 28 Mar 2024 19:17:10 -0600 Gustavo A. R. Silva wrote:
> --- a/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c
> @@ -34,8 +34,11 @@ enum nfp_dumpspec_type {
>
> /* generic type plus length */
> struct nfp_dump_tl {
> - __be32 type;
> - __be32 length; /* chunk length to follow, aligned to 8 bytes */
> + /* New members must be added within the struct_group() macro below. */
> + struct_group_tagged(nfp_dump_tl_hdr, hdr,
> + __be32 type;
> + __be32 length; /* chunk length to follow, aligned to 8 bytes */
> + );
> char data[];
> };

I counted 9 references to nfp_dump_tl->data.
Better to add:

static void *nfp_dump_tl_data(struct nfp_dump_tl *spec)
{
return &spec[1];
}

and delete the flex array completely.
--
pw-bot: cr