Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH][next] IB/hfi1: Avoid -Wflex-array-member-not-at-end warning
Date: Sun, 30 Mar 2025 11:53:33 +0200	[thread overview]
Message-ID: <cdc1fbbb-4299-4283-9bac-f1d7fb6962b6@linux.dev> (raw)
In-Reply-To: <Z-WgwsCYIXaBxnvs@kspp>

在 2025/3/27 20:02, Gustavo A. R. Silva 写道:
> -Wflex-array-member-not-at-end was introduced in GCC-14, and we are
> getting ready to enable it, globally.
> 
> Move the conflicting declaration to the end of the structure. Notice
> that `struct opa_mad_notice_attr` is a flexible structure --a structure
> that contains a flexible-array member.
> 
> Fix the following warning:
> 
> drivers/infiniband/hw/hfi1/mad.c:23:36: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> 
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>

Thanks,
Zhu Yanjun

> ---
>   drivers/infiniband/hw/hfi1/mad.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/hfi1/mad.c b/drivers/infiniband/hw/hfi1/mad.c
> index b39f63ce6dfc..3f11a90819d1 100644
> --- a/drivers/infiniband/hw/hfi1/mad.c
> +++ b/drivers/infiniband/hw/hfi1/mad.c
> @@ -20,12 +20,14 @@
>   
>   struct trap_node {
>   	struct list_head list;
> -	struct opa_mad_notice_attr data;
>   	__be64 tid;
>   	int len;
>   	u32 retry;
>   	u8 in_use;
>   	u8 repress;
> +
> +	/* Must be last --ends in a flexible-array member. */
> +	struct opa_mad_notice_attr data;
>   };
>   
>   static int smp_length_check(u32 data_size, u32 request_len)


      reply	other threads:[~2025-03-30  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27 19:02 [PATCH][next] IB/hfi1: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-03-30  9:53 ` Zhu Yanjun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdc1fbbb-4299-4283-9bac-f1d7fb6962b6@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=gustavoars@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox