linux/drivers/message/fusion
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
..
lsi scsi: message: mptlan: Replace one-element array with flexible-array member 2021-04-01 23:03:10 -04:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mptbase.c scsi: message: fusion: Remove unnecessary cast 2021-03-24 22:33:31 -04:00
mptbase.h scsi: fusion: Fix a typo in the file mptbase.h 2021-03-18 22:27:43 -04:00
mptctl.c scsi: mptctl: Remove unneeded cast from memory allocation 2020-08-20 23:17:35 -04:00
mptctl.h
mptdebug.h scsi: message: fusion: Avoid -Wempty-body warnings 2021-04-01 22:55:25 -04:00
mptfc.c scsi: message: fusion: Remove in_interrupt() usage in mpt_config() 2020-12-01 00:03:53 -05:00
mptlan.c scsi: message: mptlan: Replace one-element array with flexible-array member 2021-04-01 23:03:10 -04:00
mptlan.h scsi: fusion: fix if-statement empty body warning 2020-03-11 23:07:57 -04:00
mptsas.c scsi: core: Add scsi_device_busy() wrapper 2021-03-04 17:37:00 -05:00
mptsas.h scsi: message: fusion: Remove in_interrupt() usage in mptsas_cleanup_fw_event_q() 2020-12-01 00:03:54 -05:00
mptscsih.c SCSI misc on 20201216 2020-12-16 13:34:31 -08:00
mptscsih.h scsi: drop reason argument from ->change_queue_depth 2014-11-24 14:45:27 +01:00
mptspi.c scsi: message: fusion: Remove in_interrupt() usage in mpt_config() 2020-12-01 00:03:53 -05:00