Skip to content

Commit 778d7cd

Browse files
Merge patch series "scsi: mpi3mr: Replace 1-element arrays with flexible arrays"
Kees Cook <kees@kernel.org> says: Replace all the uses of deprecated 1-element "fake" flexible arrays with modern C99 flexible arrays. Link: https://lore.kernel.org/r/20240711155446.work.681-kees@kernel.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 8400291 + a62193a commit 778d7cd

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,16 +1565,13 @@ struct mpi3_sas_io_unit0_phy_data {
15651565
__le32 reserved10;
15661566
};
15671567

1568-
#ifndef MPI3_SAS_IO_UNIT0_PHY_MAX
1569-
#define MPI3_SAS_IO_UNIT0_PHY_MAX (1)
1570-
#endif
15711568
struct mpi3_sas_io_unit_page0 {
15721569
struct mpi3_config_page_header header;
15731570
__le32 reserved08;
15741571
u8 num_phys;
15751572
u8 init_status;
15761573
__le16 reserved0e;
1577-
struct mpi3_sas_io_unit0_phy_data phy_data[MPI3_SAS_IO_UNIT0_PHY_MAX];
1574+
struct mpi3_sas_io_unit0_phy_data phy_data[];
15781575
};
15791576

15801577
#define MPI3_SASIOUNIT0_PAGEVERSION (0x00)
@@ -1606,9 +1603,6 @@ struct mpi3_sas_io_unit1_phy_data {
16061603
__le32 reserved08;
16071604
};
16081605

1609-
#ifndef MPI3_SAS_IO_UNIT1_PHY_MAX
1610-
#define MPI3_SAS_IO_UNIT1_PHY_MAX (1)
1611-
#endif
16121606
struct mpi3_sas_io_unit_page1 {
16131607
struct mpi3_config_page_header header;
16141608
__le16 control_flags;
@@ -1618,7 +1612,7 @@ struct mpi3_sas_io_unit_page1 {
16181612
u8 num_phys;
16191613
u8 sata_max_q_depth;
16201614
__le16 reserved12;
1621-
struct mpi3_sas_io_unit1_phy_data phy_data[MPI3_SAS_IO_UNIT1_PHY_MAX];
1615+
struct mpi3_sas_io_unit1_phy_data phy_data[];
16221616
};
16231617

16241618
#define MPI3_SASIOUNIT1_PAGEVERSION (0x00)

drivers/scsi/mpi3mr/mpi/mpi30_ioc.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,6 @@ struct mpi3_event_data_sas_notify_primitive {
453453
#define MPI3_EVENT_NOTIFY_PRIMITIVE_POWER_LOSS_EXPECTED (0x02)
454454
#define MPI3_EVENT_NOTIFY_PRIMITIVE_RESERVED1 (0x03)
455455
#define MPI3_EVENT_NOTIFY_PRIMITIVE_RESERVED2 (0x04)
456-
#ifndef MPI3_EVENT_SAS_TOPO_PHY_COUNT
457-
#define MPI3_EVENT_SAS_TOPO_PHY_COUNT (1)
458-
#endif
459456
struct mpi3_event_sas_topo_phy_entry {
460457
__le16 attached_dev_handle;
461458
u8 link_rate;
@@ -496,7 +493,7 @@ struct mpi3_event_data_sas_topology_change_list {
496493
u8 start_phy_num;
497494
u8 exp_status;
498495
u8 io_unit_port;
499-
struct mpi3_event_sas_topo_phy_entry phy_entry[MPI3_EVENT_SAS_TOPO_PHY_COUNT];
496+
struct mpi3_event_sas_topo_phy_entry phy_entry[] __counted_by(num_entries);
500497
};
501498

502499
#define MPI3_EVENT_SAS_TOPO_ES_NO_EXPANDER (0x00)
@@ -545,9 +542,6 @@ struct mpi3_event_data_pcie_enumeration {
545542
#define MPI3_EVENT_PCIE_ENUM_ES_MAX_SWITCHES_EXCEED (0x40000000)
546543
#define MPI3_EVENT_PCIE_ENUM_ES_MAX_DEVICES_EXCEED (0x20000000)
547544
#define MPI3_EVENT_PCIE_ENUM_ES_RESOURCES_EXHAUSTED (0x10000000)
548-
#ifndef MPI3_EVENT_PCIE_TOPO_PORT_COUNT
549-
#define MPI3_EVENT_PCIE_TOPO_PORT_COUNT (1)
550-
#endif
551545
struct mpi3_event_pcie_topo_port_entry {
552546
__le16 attached_dev_handle;
553547
u8 port_status;
@@ -588,7 +582,7 @@ struct mpi3_event_data_pcie_topology_change_list {
588582
u8 switch_status;
589583
u8 io_unit_port;
590584
__le32 reserved0c;
591-
struct mpi3_event_pcie_topo_port_entry port_entry[MPI3_EVENT_PCIE_TOPO_PORT_COUNT];
585+
struct mpi3_event_pcie_topo_port_entry port_entry[] __counted_by(num_entries);
592586
};
593587

594588
#define MPI3_EVENT_PCIE_TOPO_SS_NO_PCIE_SWITCH (0x00)

0 commit comments

Comments
 (0)