Skip to content

Commit ac5b750

Browse files
keesmartinkpetersen
authored andcommitted
scsi: mpi3mr: struct mpi3_event_data_sas_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_sas_topology_change_list with a modern flexible array. Additionally add __counted_by annotation since phy_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->phy_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-1-kees@kernel.org Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 8400291 commit ac5b750

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
@@ -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)

0 commit comments

Comments
 (0)