• James Seo's avatar
    scsi: mpt3sas: Make MPI2_CONFIG_PAGE_RAID_VOL_0::PhysDisk[] a flexible array · cb7c03c5
    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_RAID_VOL_0 (Mpi2RaidVolPage0_t) either
    calculate its size without depending on its sizeof() or do not use
    PhysDisk[], no further source changes are required:
    
     - mpt3sas_config.c:mpt3sas_config_get_number_pds() fetches a
       Mpi2RaidVolPage0_t for itself, but does not use PhysDisk[].
    
     - mpt3sas_config.c:mpt3sas_config_get_raid_volume_pg0() fetches a
       Mpi2RaidVolPage0_t into a caller-provided buffer, and may fetch and
       write PhysDisk[] into that buffer depending on its sz argument.  Its
       callers:
    
       - mpt3sas_scsih.c:scsih_get_resync(),
         mpt3sas_scsih.c:scsih_get_state(),
         mpt3sas_scsih.c:_scsih_search_responding_raid_devices(), and
         mpt3sas_scsih.c:_scsih_scan_for_devices_after_reset() all pass
         sizeof(Mpi2RaidVolPage0_t) as sz, but do not use PhysDisk[].
    
       - mpt3sas_scsih.c:_scsih_get_volume_capabilities() and
         mpt3sas_warpdrive.c:mpt3sas_init_warpdrive_properties()
         both calculate sz independently of sizeof(Mpi2RaidVolPage0_t)
         and allocate a suitable buffer before calling
         mpt3sas_config_get_raid_volume_pg0() and using PhysDisk[].
    Signed-off-by: default avatarJames Seo <james@equiv.tech>
    Link: https://lore.kernel.org/r/20230806170604.16143-4-james@equiv.techTested-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    cb7c03c5
mpi2_cnfg.h 170 KB