lkml.org 
[lkml]   [2024]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][next] nfp: Avoid -Wflex-array-member-not-at-end warnings
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

\
 
 \ /
  Last update: 2024-04-02 06:24    [W:0.058 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site