• James Seo's avatar
    scsi: mpt3sas: Make MPI2_CONFIG_PAGE_SASIOUNIT_0::PhyData[] a flexible array · dccc1e3e
    James Seo authored
    This terminal 1-length variable array can be directly converted into a C99
    flexible array member.
    
    As all users of MPI2_CONFIG_PAGE_SASIOUNIT_0 (Mpi2SasIOUnitPage0_t) either
    calculate its size without depending on its sizeof() or do not use
    PhyData[], no further source changes are required:
    
     - mpt3sas_config.c:mpt3sas_config_get_number_hba_phys() fetches a
       Mpi2SasIOUnitPage0_t for itself, but does not use PhyData[].
    
     - mpt3sas_config.c:mpt3sas_config_get_sas_iounit_pg0() fetches a
       Mpi2SasIOUnitPage0_t into a caller-provided buffer, and may fetch and
       write PhyData[] into that buffer depending on its sz argument.  Its
       callers:
    
       - mpt3sas_scsih.c:_scsih_update_vphys_after_reset(),
         mpt3sas_scsih.c:_scsih_get_port_table_after_reset(),
         mpt3sas_scsih.c:_scsih_sas_host_refresh(),
         mpt3sas_scsih.c:_scsih_sas_host_add(), and
         mpt3sas_transport.c:_transport_phy_enable() all calculate sz
         independently of sizeof(Mpi2SasIOUnitPage0_t) and allocate a
         suitable buffer before calling mpt3sas_config_get_sas_iounit_pg0()
         and using PhyData[].
    Signed-off-by: default avatarJames Seo <james@equiv.tech>
    Link: https://lore.kernel.org/r/20230806170604.16143-5-james@equiv.techTested-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    dccc1e3e
mpi2_cnfg.h 170 KB