[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yq1qzv5b1gd.fsf@ca-mkp.ca.oracle.com>
Date: Tue, 14 Oct 2025 17:47:50 -0400
From: "Martin K. Petersen" <martin.petersen@...cle.com>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Kashyap Desai <kashyap.desai@...adcom.com>,
Sumit Saxena
<sumit.saxena@...adcom.com>,
Shivasharan S
<shivasharan.srikanteshwara@...adcom.com>,
Chandrakanth patil
<chandrakanth.patil@...adcom.com>,
"James E.J. Bottomley"
<James.Bottomley@...senpartnership.com>,
"Martin K. Petersen"
<martin.petersen@...cle.com>,
megaraidlinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2][next] scsi: megaraid_sas: Avoid a couple
-Wflex-array-member-not-at-end warnings
Gustavo,
> -Wflex-array-member-not-at-end was introduced in GCC-14, and we are
> getting ready to enable it, globally.
>
> Use the new TRAILING_OVERLAP() helper to fix the following warnings:
>
> drivers/scsi/megaraid/megaraid_sas_fusion.h:1153:31: warning:
> structure containing a flexible array member is not at the end of
> another structure [-Wflex-array-member-not-at-end]
> drivers/scsi/megaraid/megaraid_sas_fusion.h:1198:32: warning:
> structure containing a flexible array member is not at the end of
> another structure [-Wflex-array-member-not-at-end]
>
> This helper creates a union between a flexible-array member (FAM) and
> a set of MEMBERS that would otherwise follow it --in this case `struct
> MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_DYN]` and `struct
> MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES]` in the corresponding
> structures.
>
> This overlays the trailing members onto the FAM (struct MR_LD_SPAN_MAP
> ldSpanMap[];) while keeping the FAM and the start of MEMBERS aligned.
>
> The static_assert() ensures this alignment remains, and it's
> intentionally placed inmediately after the corresponding structures
> --no blank line in between.
Applied to 6.19/scsi-staging, thanks!
--
Martin K. Petersen
Powered by blists - more mailing lists