linux-stable/drivers/scsi/mpt3sas
Gustavo A. R. Silva a1c4d77413 scsi: mpt3sas: Replace unnecessary dynamic allocation with a static one
Dynamic memory allocation isn't actually needed and it can be replaced by
statically allocating memory for struct object io_unit_pg3 with 36
hardcoded entries for its GPIOVal array.

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

drivers/scsi/mpt3sas/mpt3sas_ctl.c: In function ‘BRM_status_show’:
drivers/scsi/mpt3sas/mpt3sas_ctl.c:3257:63: warning: array subscript 24 is above array bounds of ‘U16[1]’ {aka ‘short unsigned int[1]’} [-Warray-bounds]
 3257 |  backup_rail_monitor_status = le16_to_cpu(io_unit_pg3->GPIOVal[24]);
./include/uapi/linux/byteorder/little_endian.h:36:51: note: in definition of macro ‘__le16_to_cpu’
   36 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
      |                                                   ^
drivers/scsi/mpt3sas/mpt3sas_ctl.c:3257:31: note: in expansion of macro ‘le16_to_cpu’
 3257 |  backup_rail_monitor_status = le16_to_cpu(io_unit_pg3->GPIOVal[24]);

Link: https://github.com/KSPP/linux/issues/109
Link: https://lore.kernel.org/lkml/202103101058.16ED27BE3@keescook/
Link: https://lore.kernel.org/r/20210310235951.GA108661@embeddedor
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-03-17 00:04:40 -04:00
..
mpi scsi: mpt3sas: Replace unnecessary dynamic allocation with a static one 2021-03-17 00:04:40 -04:00
Kconfig scsi: mpt3sas: Fix spelling mistake in Kconfig "compatiblity" -> "compatibility" 2021-01-05 23:25:07 -05:00
Makefile
mpt3sas_base.c scsi: mpt3sas: Fix misspelling of _base_put_smid_default_atomic() 2021-03-15 22:14:54 -04:00
mpt3sas_base.h scsi: mpt3sas: Update driver version to 37.100.00.00 2021-02-08 22:02:07 -05:00
mpt3sas_config.c scsi: mpt3sas: Fix a bunch of potential naming doc-rot 2021-03-15 22:28:56 -04:00
mpt3sas_ctl.c scsi: mpt3sas: Replace unnecessary dynamic allocation with a static one 2021-03-17 00:04:40 -04:00
mpt3sas_ctl.h scsi: mpt3sas: Additional diagnostic buffer query interface 2021-02-08 22:02:07 -05:00
mpt3sas_debug.h
mpt3sas_debugfs.c scsi: mpt3sas: Remove unused including <linux/version.h> 2020-05-11 23:09:21 -04:00
mpt3sas_scsih.c scsi: mpt3sas: Move a little data from the stack onto the heap 2021-03-15 22:14:54 -04:00
mpt3sas_transport.c scsi: mpt3sas: Fix a couple of misdocumented functions/params 2021-03-15 22:28:57 -04:00
mpt3sas_trigger_diag.c scsi: mpt3sas: Additional diagnostic buffer query interface 2021-02-08 22:02:07 -05:00
mpt3sas_trigger_diag.h scsi: mpt3sas: Fix spelling mistake 2020-06-15 23:28:46 -04:00
mpt3sas_trigger_pages.h scsi: mpt3sas: Add persistent trigger pages support 2020-12-09 11:34:18 -05:00
mpt3sas_warpdrive.c