scsi: hisi_sas: Avoid a couple -Wflex-array-member-not-at-end warnings
Subsystems (2)
PATCH 1/1 scsi: hisi_sas: Avoid a couple -Wflex-array-member-not-at-end warnings
-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]
--- drivers/scsi/hisi_sas/hisi_sas.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/scsi/hisi_sas/hisi_sas.h +7 -3
@@ -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;
Signature · 1 line
2.43.0
Hi all,
Friendly ping: who can take this, please?
Thanks!
-Gustavo
Quoted 52 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 declarations to the end of the corresponding structures (and in a union). Notice that
struct ssp_command_iuis 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 <[email protected]>--- drivers/scsi/hisi_sas/hisi_sas.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/scsi/hisi_sas/hisi_sas.h +7
-3@@ -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;
Quoted 26 lines · Gustavo A. R. Silva
Hi all,
Friendly ping: who can take this, please?
Thanks!
-GustavoQuoted 18 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 declarations to the end of the corresponding structures (and in a union). Notice that
struct ssp_command_iuis 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 <[email protected]>---
drivers/scsi/hisi_sas/hisi_sas.h| 10 +++++++---1 file changed, 7 insertions(+), 3 deletions(-)
Quoted 12 lines
drivers/scsi/hisi_sas/hisi_sas.h struct hisi_sas_command_table_ssp { · line 618
Quoted 12 lines
drivers/scsi/hisi_sas/hisi_sas.h +1
-1@@ -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; };
Actually, I have a question here:
is u32 prot[PROT_BUF_SIZE]; intended to overlap flex array task.add_cdb[] at some point?
if not, this change is just fine. Otherwise, I'd need to update this patch to account for the overlap.
Could someone provide some feedback here? :)
Thanks!
-Gustavo
Quoted 20 lines
Quoted 19 lines
drivers/scsi/hisi_sas/hisi_sas.h +6
-2struct 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;
Gustavo,
Quoted 6 lines
Quoted 5 lines
drivers/scsi/hisi_sas/hisi_sas.h struct hisi_sas_command_table_ssp { · line 618
Quoted 5 lines
struct {drivers/scsi/hisi_sas/hisi_sas.h +1
-1-struct ssp_command_iu task;u32 prot[PROT_BUF_SIZE ]; +struct ssp_command_iu task; };
Quoted 7 lines
Actually, I have a question here:
is u32 prot[PROT_BUF_SIZE]; intended to overlap flex array task.add_cdb[] at some point?
if not, this change is just fine. Otherwise, I'd need to update this patch to account for the overlap.
I am not familiar with the hisi hardware interface so I don't know whether the overlap is intentional.
Signature · 1 line
Martin K. Petersen