scsi: mpt3sas: Make MPI2_CONFIG_PAGE_IO_UNIT_8::Sensor[] a flexible array
authorJames Seo <james@equiv.tech>
Sun, 6 Aug 2023 17:05:54 +0000 (10:05 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 15 Nov 2023 13:52:01 +0000 (08:52 -0500)
commitf7830af68eb66d1db193129918036eb98708e6a5
tree03ec692a9e54181cbb3f53e1173c310b0efec193
parentaa4db51bbd51654e215905f384eecf22327bafa9
scsi: mpt3sas: Make MPI2_CONFIG_PAGE_IO_UNIT_8::Sensor[] a flexible array

This terminal 1-length variable array can be directly converted into a C99
flexible array member.

As all users of MPI2_CONFIG_PAGE_IO_UNIT_8 (Mpi2IOUnitPage8_t) do not use
Sensor[], no further source changes are required to accommodate its reduced
sizeof():

 - mpt3sas_config.c:mpt3sas_config_get_iounit_pg8() fetches a
   Mpi2IOUnitPage8_t into a caller-provided buffer, assuming
   sizeof(Mpi2IOUnitPage8_t) as the buffer size. It has one caller:

   - mpt3sas_base.c:_base_static_config_pages() passes the address of the
     Mpi2IOUnitPage8_t iounit_pg8 member of the per-adapter struct (struct
     MPT3SAS_ADAPTER *ioc) as the buffer. The assumed buffer size is
     therefore correct.

     However, the only subsequent use in mpt3sas of the thus populated
     ioc->iounit_pg8 is a little further on in the same function, and this
     use does not involve ioc->iounit_pg8.Sensor[].

     Note that iounit_pg8 occurs in the middle of the per-adapter struct,
     not at the end. The per-adapter struct is extensively used throughout
     mpt3sas even if its iounit_pg8 member isn't, resulting in an
     especially large amount of noise when comparing binary changes
     attributable to this commit.

Signed-off-by: James Seo <james@equiv.tech>
Link: https://lore.kernel.org/r/20230806170604.16143-3-james@equiv.tech
Tested-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h