linux-stable/drivers/message
Kees Cook de80fe29ab scsi: message: fusion: struct _CONFIG_PAGE_IOC_2: Replace 1-element array with flexible array
Replace the deprecated[1] use of a 1-element array in struct
_CONFIG_PAGE_IOC_2 with a modern flexible array.

Additionally add __counted_by annotation since RaidVolume is only ever
accessed from loops controlled by NumActiveVolumes:

lsi/mpi_cnfg.h:    CONFIG_PAGE_IOC_2_RAID_VOL  RaidVolume[] __counted_by(NumActiveVolumes); /* 0Ch */
mptbase.c:      for (i = 0; i < pIoc2->NumActiveVolumes ; i++)
mptbase.c:                  pIoc2->RaidVolume[i].VolumeBus,
mptbase.c:                  pIoc2->RaidVolume[i].VolumeID);
mptsas.c:               for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
mptsas.c:                                       RaidVolume[i].VolumeID) {
mptsas.c:                                       RaidVolume[i].VolumeBus;
mptsas.c:       for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
mptsas.c:                   ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0);
mptsas.c:                   ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID);
mptsas.c:                   ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0);
mptsas.c:               for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
mptsas.c:                       if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID ==
mptsas.c:       for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
mptsas.c:               if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id)
mptspi.c:       for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
mptspi.c:               if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) {

No binary differences are present after this conversion.

Link: https://github.com/KSPP/linux/issues/79 [1]
Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20240711172821.123936-4-kees@kernel.org
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-02 21:32:52 -04:00
..
fusion scsi: message: fusion: struct _CONFIG_PAGE_IOC_2: Replace 1-element array with flexible array 2024-08-02 21:32:52 -04:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00