From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Kees Cook <kees@kernel.org>,
Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>,
Sumit Saxena <sumit.saxena@broadcom.com>,
Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Ranjan Kumar <ranjan.kumar@broadcom.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
mpi3mr-linuxdrv.pdl@broadcom.com, linux-scsi@vger.kernel.org,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] scsi: mpi3mr: struct mpi3_event_data_sas_topology_change_list: Replace 1-element array with flexible array
Date: Thu, 11 Jul 2024 10:16:15 -0600 [thread overview]
Message-ID: <15be9ec9-02a1-452d-aee5-d6536eef6796@embeddedor.com> (raw)
In-Reply-To: <20240711155637.3757036-1-kees@kernel.org>
On 11/07/24 09:56, Kees Cook wrote:
> 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: https://github.com/KSPP/linux/issues/79 [1]
> Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Thanks
--
Gustavo
> ---
> Cc: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
> Cc: Kashyap Desai <kashyap.desai@broadcom.com>
> Cc: Sumit Saxena <sumit.saxena@broadcom.com>
> Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
> Cc: Ranjan Kumar <ranjan.kumar@broadcom.com>
> Cc: Stephen Rothwell <sfr@canb.auug.org.au>
> Cc: mpi3mr-linuxdrv.pdl@broadcom.com
> Cc: linux-scsi@vger.kernel.org
> Cc: linux-hardening@vger.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 028784949873..ae74fccc65b8 100644
> --- a/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h
> +++ b/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h
> @@ -453,9 +453,6 @@ struct mpi3_event_data_sas_notify_primitive {
> #define MPI3_EVENT_NOTIFY_PRIMITIVE_POWER_LOSS_EXPECTED (0x02)
> #define MPI3_EVENT_NOTIFY_PRIMITIVE_RESERVED1 (0x03)
> #define MPI3_EVENT_NOTIFY_PRIMITIVE_RESERVED2 (0x04)
> -#ifndef MPI3_EVENT_SAS_TOPO_PHY_COUNT
> -#define MPI3_EVENT_SAS_TOPO_PHY_COUNT (1)
> -#endif
> struct mpi3_event_sas_topo_phy_entry {
> __le16 attached_dev_handle;
> u8 link_rate;
> @@ -496,7 +493,7 @@ struct mpi3_event_data_sas_topology_change_list {
> u8 start_phy_num;
> u8 exp_status;
> u8 io_unit_port;
> - struct mpi3_event_sas_topo_phy_entry phy_entry[MPI3_EVENT_SAS_TOPO_PHY_COUNT];
> + struct mpi3_event_sas_topo_phy_entry phy_entry[] __counted_by(num_entries);
> };
>
> #define MPI3_EVENT_SAS_TOPO_ES_NO_EXPANDER (0x00)
next prev parent reply other threads:[~2024-07-11 16:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 15:56 [PATCH 0/4] scsi: mpi3mr: Replace 1-element arrays with flexible arrays Kees Cook
2024-07-11 15:56 ` [PATCH 1/4] scsi: mpi3mr: struct mpi3_event_data_sas_topology_change_list: Replace 1-element array with flexible array Kees Cook
2024-07-11 16:16 ` Gustavo A. R. Silva [this message]
2024-07-11 15:56 ` [PATCH 2/4] scsi: mpi3mr: struct mpi3_event_data_pcie_topology_change_list: " Kees Cook
2024-07-11 16:17 ` Gustavo A. R. Silva
2024-07-11 15:56 ` [PATCH 3/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page0: " Kees Cook
2024-07-11 16:18 ` Gustavo A. R. Silva
2024-07-11 15:56 ` [PATCH 4/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page1: " Kees Cook
2024-07-11 16:25 ` Gustavo A. R. Silva
2024-08-03 1:24 ` [PATCH 0/4] scsi: mpi3mr: Replace 1-element arrays with flexible arrays Martin K. Petersen
2024-08-05 21:17 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15be9ec9-02a1-452d-aee5-d6536eef6796@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=gustavoars@kernel.org \
--cc=kashyap.desai@broadcom.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mpi3mr-linuxdrv.pdl@broadcom.com \
--cc=ranjan.kumar@broadcom.com \
--cc=sathya.prakash@broadcom.com \
--cc=sfr@canb.auug.org.au \
--cc=sreekanth.reddy@broadcom.com \
--cc=sumit.saxena@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®