From: Martin K. Petersen Date: Wed, 15 Nov 2023 15:04:03 +0000 (-0500) Subject: Merge patch series "scsi: mpt3sas: Use flexible arrays and do a few cleanups" X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=fd7090e384725edb1910a4b0a9c51007858f2c81;p=linux.git Merge patch series "scsi: mpt3sas: Use flexible arrays and do a few cleanups" James Seo says: Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") has resulted in the only arrays that UBSAN_BOUNDS considers unbounded being trailing arrays declared with [] as the last member of a struct. Unbounded trailing arrays declared with [1] are common in mpt3sas, which is causing spurious warnings to appear in some situations, e.g. when more than one physical disk is connected: UBSAN: array-index-out-of-bounds in drivers/scsi/mpt3sas/mpt3sas_scsih.c:6810:36 index 1 is out of range for type 'MPI2_SAS_IO_UNIT0_PHY_DATA [1]' which relates to this unbounded array access: port_id = sas_iounit_pg0->PhyData[i].Port; and is just one example of 10 similar warnings currently occurring for me during boot. This series converts most trailing arrays declared with [1] in mptsas into proper C99 flexible array members. Those that are not unbounded and really are fixed-length arrays of length 1 are left alone. I didn't find any conversions that required further source edits besides changing [1] to [], and everything seems to work with my SAS2008-based add-in card, but please look things over in case I missed something subtle. Rounding out the series are some opportunistic cleanups. The only dependency is that patch 7 ("Use struct_size() for struct size calculations") depends on patches 3-5. Link: https://lore.kernel.org/r/20230806170604.16143-1-james@equiv.tech Signed-off-by: Martin K. Petersen --- fd7090e384725edb1910a4b0a9c51007858f2c81