[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bd2f6ce6-f6c9-4aac-b34f-d9c55cefd17d@embeddedor.com>
Date: Thu, 11 Jul 2024 10:17:37 -0600
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Kees Cook <kees@...nel.org>,
Sathya Prakash Veerichetty <sathya.prakash@...adcom.com>
Cc: Kashyap Desai <kashyap.desai@...adcom.com>,
Sumit Saxena <sumit.saxena@...adcom.com>,
Sreekanth Reddy <sreekanth.reddy@...adcom.com>,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Ranjan Kumar <ranjan.kumar@...adcom.com>,
Stephen Rothwell <sfr@...b.auug.org.au>, mpi3mr-linuxdrv.pdl@...adcom.com,
linux-scsi@...r.kernel.org, linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] scsi: mpi3mr: struct
mpi3_event_data_pcie_topology_change_list: Replace 1-element array with
flexible array
On 11/07/24 09:56, Kees Cook wrote:
> 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: https://github.com/KSPP/linux/issues/79 [1]
> Signed-off-by: Kees Cook <kees@...nel.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>
Thanks
--
Gustavo
> ---
> Cc: Sathya Prakash Veerichetty <sathya.prakash@...adcom.com>
> Cc: Kashyap Desai <kashyap.desai@...adcom.com>
> Cc: Sumit Saxena <sumit.saxena@...adcom.com>
> Cc: Sreekanth Reddy <sreekanth.reddy@...adcom.com>
> Cc: "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>
> Cc: "Martin K. Petersen" <martin.petersen@...cle.com>
> Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Cc: Ranjan Kumar <ranjan.kumar@...adcom.com>
> Cc: Stephen Rothwell <sfr@...b.auug.org.au>
> Cc: mpi3mr-linuxdrv.pdl@...adcom.com
> Cc: linux-scsi@...r.kernel.org
> Cc: linux-hardening@...r.kernel.org
> ---
> drivers/scsi/mpi3mr/mpi/mpi30_ioc.h | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h b/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h
> index ae74fccc65b8..c9fa0d69b75f 100644
> --- a/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h
> +++ b/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h
> @@ -542,9 +542,6 @@ struct mpi3_event_data_pcie_enumeration {
> #define MPI3_EVENT_PCIE_ENUM_ES_MAX_SWITCHES_EXCEED (0x40000000)
> #define MPI3_EVENT_PCIE_ENUM_ES_MAX_DEVICES_EXCEED (0x20000000)
> #define MPI3_EVENT_PCIE_ENUM_ES_RESOURCES_EXHAUSTED (0x10000000)
> -#ifndef MPI3_EVENT_PCIE_TOPO_PORT_COUNT
> -#define MPI3_EVENT_PCIE_TOPO_PORT_COUNT (1)
> -#endif
> struct mpi3_event_pcie_topo_port_entry {
> __le16 attached_dev_handle;
> u8 port_status;
> @@ -585,7 +582,7 @@ struct mpi3_event_data_pcie_topology_change_list {
> u8 switch_status;
> u8 io_unit_port;
> __le32 reserved0c;
> - struct mpi3_event_pcie_topo_port_entry port_entry[MPI3_EVENT_PCIE_TOPO_PORT_COUNT];
> + struct mpi3_event_pcie_topo_port_entry port_entry[] __counted_by(num_entries);
> };
>
> #define MPI3_EVENT_PCIE_TOPO_SS_NO_PCIE_SWITCH (0x00)
Powered by blists - more mailing lists