Skip to contentSkip to conversation

scsi: megaraid_sas: Convert union megasas_sgl to flex-arrays

PATCH Applied Kees Cook 2 participants 3 messages May 11, 2023 – May 22, 2023

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 scsi: megaraid_sas: Convert union megasas_sgl to flex-arrays

In the ongoing effort to replace all fake flexible arrays with true flexible arrays, replace the sge32, sge64, and sge_skinny members of union megasas_sgl with true flexible arrays. No binary differences are seen after this change; sizes were already being manually calculated using the member struct sizes directly.

Cc Kashyap Desai <[email protected]>
Cc Sumit Saxena <[email protected]>
Cc Shivasharan S <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc Gustavo A. R. Silva <[email protected]>
---
 drivers/scsi/megaraid/megaraid_sas.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +3 -5
index 63bac3684c19..3554f6b07727 100644
@@ -1722,11 +1722,9 @@ struct megasas_sge_skinny {
 } __packed;
 
 union megasas_sgl {
-
-	struct megasas_sge32 sge32[1];
-	struct megasas_sge64 sge64[1];
-	struct megasas_sge_skinny sge_skinny[1];
-
+	DECLARE_FLEX_ARRAY(struct megasas_sge32, sge32);
+	DECLARE_FLEX_ARRAY(struct megasas_sge64, sge64);
+	DECLARE_FLEX_ARRAY(struct megasas_sge_skinny, sge_skinny);
 } __attribute__ ((packed));
 
 struct megasas_header {
Signature · 1 line
2.34.1
#1 lore raw

Kees,

Quoted 5 lines

In the ongoing effort to replace all fake flexible arrays with true flexible arrays, replace the sge32, sge64, and sge_skinny members of union megasas_sgl with true flexible arrays. No binary differences are seen after this change; sizes were already being manually calculated using the member struct sizes directly.

Applied to 6.5/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
In reply to Kees Cook
Quoted 8 lines · Kees Cook

In the ongoing effort to replace all fake flexible arrays with true flexible arrays, replace the sge32, sge64, and sge_skinny members of union megasas_sgl with true flexible arrays. No binary differences are seen after this change; sizes were already being manually calculated using the member struct sizes directly.

[...]

Applied to 6.5/scsi-queue, thanks!

[1/1] scsi: megaraid_sas: Convert union megasas_sgl to flex-arrays

      https://git.kernel.org/mkp/scsi/c/aa67380056a4
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering