scsi: pm8001: Replace one-element array with flexible-array member
Subsystems (2)
PATCH 1/1 scsi: pm8001: Replace one-element array with flexible-array member
One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct fw_control_info.
This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].
--- drivers/scsi/pm8001/pm8001_sas.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/pm8001/pm8001_sas.h +1 -1
@@ -612,7 +612,7 @@ struct fw_control_info {operations.*/ u32 reserved;/* padding required for 64 bit alignment */ -u8 buffer[1 ];/* Start of buffer */ +u8 buffer[];/* Start of buffer */ };struct fw_control_ex {struct fw_control_info *fw_control;
Signature · 1 line
2.34.1
Quoted 5 lines · Gustavo A. R. Silva
One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct
fw_control_info.
Quoted 8 lines
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].
Quoted 20 lines
--- drivers/scsi/pm8001/pm8001_sas.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/pm8001/pm8001_sas.h +1
-2@@ -612,7 +612,7 @@ struct fw_control_info {operations.*/ u32 reserved;/* padding required for 64 bit alignment */ -u8 buffer[1 ];/* Start of buffer */ +u8 buffer[];/* Start of buffer */ };struct fw_control_ex {struct fw_control_info *fw_control; --2.34.1
Quoted 3 lines · Gustavo A. R. Silva
One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct
fw_control_info.
I think this changelog should include some explanation of why this change is safe. As far as I can see, it would be:
This is the only change needed; struct fw_control_info is only ever used for casting to existing allocations. No sizeof() is used on any of the resulting variables.
Quoted 8 lines
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].
Another one down! :)
Signature · 1 line
Kees Cook
Martin K. Petersen
AppliedGustavo,
Quoted 3 lines
One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct
fw_control_info.
Applied to 6.1/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering