Skip to contentSkip to conversation

scsi: isci: Avoid -Wflex-array-member-not-at-end warning

PATCH Applied Gustavo A. R. Silva 3 participants 3 messages Sep 19, 2025 – Oct 14, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: isci: Avoid -Wflex-array-member-not-at-end warning

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

Move the conflicting declaration (which happens to be in a union, so we're moving the entire union) to the end of the corresponding structure. Notice that struct ssp_response_iu is a flexible structure, this is a structure that contains a flexible-array member.

With these changes fix the following warning:

drivers/scsi/isci/task.h:92:11: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

---
 drivers/scsi/isci/task.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/isci/task.h +6 -4
index f96633fa6939..d05d09c1263d 100644
@@ -85,15 +85,17 @@ struct isci_tmf {
 
 	struct completion *complete;
 	enum sas_protocol proto;
+	unsigned char lun[8];
+	u16 io_tag;
+	enum isci_tmf_function_codes tmf_code;
+	int status;
+
+	/* Must be last --ends in a flexible-array member. */
 	union {
 		struct ssp_response_iu resp_iu;
 		struct dev_to_host_fis d2h_fis;
 		u8 rsp_buf[SSP_RESP_IU_MAX_SIZE];
 	} resp;
-	unsigned char lun[8];
-	u16 io_tag;
-	enum isci_tmf_function_codes tmf_code;
-	int status;
 };
 
 static inline void isci_print_tmf(struct isci_host *ihost, struct isci_tmf *tmf)
Signature · 1 line
2.43.0
#1 lore raw

Hi all,

Friendly ping: who can take this, please?

Thanks!
-Gustavo

Quoted 43 lines · 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 (which happens to be in a union, so we're moving the entire union) to the end of the corresponding structure. Notice that struct ssp_response_iu is a flexible structure, this is a structure that contains a flexible-array member.

With these changes fix the following warning:

drivers/scsi/isci/task.h:92:11: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

---
  drivers/scsi/isci/task.h | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/isci/task.h +6 -4
index f96633fa6939..d05d09c1263d 100644
@@ -85,15 +85,17 @@ struct isci_tmf {
 
  	struct completion *complete;
  	enum sas_protocol proto;
+	unsigned char lun[8];
+	u16 io_tag;
+	enum isci_tmf_function_codes tmf_code;
+	int status;
+
+	/* Must be last --ends in a flexible-array member. */
  	union {
  		struct ssp_response_iu resp_iu;
  		struct dev_to_host_fis d2h_fis;
  		u8 rsp_buf[SSP_RESP_IU_MAX_SIZE];
  	} resp;
-	unsigned char lun[8];
-	u16 io_tag;
-	enum isci_tmf_function_codes tmf_code;
-	int status;
  };
 
  static inline void isci_print_tmf(struct isci_host *ihost, struct isci_tmf *tmf)
#2 lore raw
In reply to Gustavo A. R. Silva

Gustavo,

Quoted 8 lines

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

Move the conflicting declaration (which happens to be in a union, so we're moving the entire union) to the end of the corresponding structure. Notice that struct ssp_response_iu is a flexible structure, this is a structure that contains a flexible-array member.

Quoted 5 lines

With these changes fix the following warning:

drivers/scsi/isci/task.h:92:11: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Applied to 6.19/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen