linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Yihang Li <liyihang9@h-partners.com>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-hardening@vger.kernel.org
Subject: [PATCH][next] scsi: hisi_sas: Avoid a couple -Wflex-array-member-not-at-end warnings
Date: Fri, 19 Sep 2025 14:17:41 +0200	[thread overview]
Message-ID: <aM1J5UemZFgdso3F@kspp> (raw)

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Move the conflicting declarations to the end of the corresponding
structures (and in a union). Notice that `struct ssp_command_iu`
is a flexible structure, this is a structure that contains a
flexible-array member.

With these changes fix the following warnings:

drivers/scsi/hisi_sas/hisi_sas.h:639:38: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/scsi/hisi_sas/hisi_sas.h:616:47: 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>
---
 drivers/scsi/hisi_sas/hisi_sas.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index 1323ed8aa717..55c638dd58b1 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -613,8 +613,8 @@ struct hisi_sas_command_table_ssp {
 	struct ssp_frame_hdr hdr;
 	union {
 		struct {
-			struct ssp_command_iu task;
 			u32 prot[PROT_BUF_SIZE];
+			struct ssp_command_iu task;
 		};
 		struct ssp_tmf_iu ssp_task;
 		struct xfer_rdy_iu xfer_rdy;
@@ -636,13 +636,17 @@ struct hisi_sas_status_buffer {
 
 struct hisi_sas_slot_buf_table {
 	struct hisi_sas_status_buffer status_buffer;
-	union hisi_sas_command_table command_header;
 	struct hisi_sas_sge_page sge_page;
+
+	/* Must be last --ends in a flexible-array member. */
+	union hisi_sas_command_table command_header;
 };
 
 struct hisi_sas_slot_dif_buf_table {
-	struct hisi_sas_slot_buf_table slot_buf;
 	struct hisi_sas_sge_dif_page sge_dif_page;
+
+	/* Must be last --ends in a flexible-array member. */
+	struct hisi_sas_slot_buf_table slot_buf;
 };
 
 extern struct scsi_transport_template *hisi_sas_stt;
-- 
2.43.0


             reply	other threads:[~2025-09-19 12:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 12:17 Gustavo A. R. Silva [this message]
2025-10-07 10:45 ` [PATCH][next] scsi: hisi_sas: Avoid a couple -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2025-10-07 10:54   ` Gustavo A. R. Silva
2025-10-14 22:19     ` Martin K. Petersen

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=aM1J5UemZFgdso3F@kspp \
    --to=gustavoars@kernel.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liyihang9@h-partners.com \
    --cc=martin.petersen@oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).