Skip to content

Commit 0e11f97

Browse files
keesmartinkpetersen
authored andcommitted
scsi: mpi3mr: struct mpi3_event_data_pcie_topology_change_list: Replace 1-element array with flexible array
Replace the deprecated[1] use of a 1-element array in struct mpi3_event_data_pcie_topology_change_list with a modern flexible array. Additionally add __counted_by annotation since port_entry is only ever accessed in loops controlled by num_entries. For example: for (i = 0; i < event_data->num_entries; i++) { handle = le16_to_cpu(event_data->port_entry[i].attached_dev_handle); No binary differences are present after this conversion. Link: KSPP#79 [1] Signed-off-by: Kees Cook <kees@kernel.org> Link: https://lore.kernel.org/r/20240711155637.3757036-2-kees@kernel.org Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent ac5b750 commit 0e11f97

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

drivers/scsi/mpi3mr/mpi/mpi30_ioc.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,6 @@ struct mpi3_event_data_pcie_enumeration {
542542
#define MPI3_EVENT_PCIE_ENUM_ES_MAX_SWITCHES_EXCEED (0x40000000)
543543
#define MPI3_EVENT_PCIE_ENUM_ES_MAX_DEVICES_EXCEED (0x20000000)
544544
#define MPI3_EVENT_PCIE_ENUM_ES_RESOURCES_EXHAUSTED (0x10000000)
545-
#ifndef MPI3_EVENT_PCIE_TOPO_PORT_COUNT
546-
#define MPI3_EVENT_PCIE_TOPO_PORT_COUNT (1)
547-
#endif
548545
struct mpi3_event_pcie_topo_port_entry {
549546
__le16 attached_dev_handle;
550547
u8 port_status;
@@ -585,7 +582,7 @@ struct mpi3_event_data_pcie_topology_change_list {
585582
u8 switch_status;
586583
u8 io_unit_port;
587584
__le32 reserved0c;
588-
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);
589586
};
590587

591588
#define MPI3_EVENT_PCIE_TOPO_SS_NO_PCIE_SWITCH (0x00)

0 commit comments

Comments
 (0)