OpenCloudOS-Kernel/drivers/message/fusion/lsi
Gustavo A. R. Silva 4e2e619f3c scsi: message: mptlan: Replace one-element array with flexible-array member
There is a regular need in the kernel to provide a way to declare having a
dynamically sized set of trailing elements in a structure. Kernel code
should always use "flexible array members"[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].

Refactor the code according to the use of a flexible-array member in struct
_SGE_TRANSACTION32 instead of one-element array.

Also, this helps with the ongoing efforts to enable -Warray-bounds by
fixing the following warning:

  CC [M]  drivers/message/fusion/mptlan.o
drivers/message/fusion/mptlan.c: In function ‘mpt_lan_sdu_send’:
drivers/message/fusion/mptlan.c:759:28: warning: array subscript 1 is above array bounds of ‘U32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds]
  759 |  pTrans->TransactionDetails[1] = cpu_to_le32((mac[2] << 24) |
      |  ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/109
Link: https://lore.kernel.org/r/20210324233344.GA99059@embeddedor
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-04-01 23:03:10 -04:00
..
mpi.h scsi: message: mptlan: Replace one-element array with flexible-array member 2021-04-01 23:03:10 -04:00
mpi_cnfg.h scsi: message: fusion: Fix 'physical' typos 2021-01-26 23:25:16 -05:00
mpi_fc.h
mpi_history.txt scsi: message: fusion: Fix 'physical' typos 2021-01-26 23:25:16 -05:00
mpi_init.h
mpi_ioc.h scsi: message: fusion: Replace one-element array with flexible-array member 2021-04-01 23:03:00 -04:00
mpi_lan.h
mpi_log_fc.h
mpi_log_sas.h
mpi_raid.h
mpi_sas.h
mpi_targ.h
mpi_tool.h
mpi_type.h