* [PATCH][next] scsi: isci: Avoid -Wflex-array-member-not-at-end warning
@ 2025-09-19 11:24 Gustavo A. R. Silva
2025-10-07 10:43 ` Gustavo A. R. Silva
2025-10-14 21:38 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2025-09-19 11:24 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel, Gustavo A. R. Silva, linux-hardening
-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]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/scsi/isci/task.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/isci/task.h b/drivers/scsi/isci/task.h
index f96633fa6939..d05d09c1263d 100644
--- a/drivers/scsi/isci/task.h
+++ b/drivers/scsi/isci/task.h
@@ -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.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] scsi: isci: Avoid -Wflex-array-member-not-at-end warning
2025-09-19 11:24 [PATCH][next] scsi: isci: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
@ 2025-10-07 10:43 ` Gustavo A. R. Silva
2025-10-14 21:38 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2025-10-07 10:43 UTC (permalink / raw)
To: Gustavo A. R. Silva, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel, linux-hardening
Hi all,
Friendly ping: who can take this, please?
Thanks!
-Gustavo
On 9/19/25 12:24, Gustavo A. R. Silva wrote:
> -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]
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
> drivers/scsi/isci/task.h | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/isci/task.h b/drivers/scsi/isci/task.h
> index f96633fa6939..d05d09c1263d 100644
> --- a/drivers/scsi/isci/task.h
> +++ b/drivers/scsi/isci/task.h
> @@ -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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] scsi: isci: Avoid -Wflex-array-member-not-at-end warning
2025-09-19 11:24 [PATCH][next] scsi: isci: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-10-07 10:43 ` Gustavo A. R. Silva
@ 2025-10-14 21:38 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2025-10-14 21:38 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, linux-hardening
Gustavo,
> -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]
Applied to 6.19/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-14 21:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19 11:24 [PATCH][next] scsi: isci: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-10-07 10:43 ` Gustavo A. R. Silva
2025-10-14 21:38 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox