public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] scsi: mpi3mr: Replace 1-element arrays with flexible arrays
@ 2024-07-11 15:56 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
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Kees Cook @ 2024-07-11 15:56 UTC (permalink / raw)
  To: Sathya Prakash Veerichetty
  Cc: Kees Cook, Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Martin K. Petersen, Gustavo A. R. Silva,
	Ranjan Kumar, Stephen Rothwell, linux-kernel, mpi3mr-linuxdrv.pdl,
	linux-scsi, linux-hardening

Hi,

Replace all the uses of deprecated 1-element "fake" flexible arrays
with modern C99 flexible arrays.

Thanks!

-Kees

Kees Cook (4):
  scsi: mpi3mr: struct mpi3_event_data_sas_topology_change_list: Replace
    1-element array with flexible array
  scsi: mpi3mr: struct mpi3_event_data_pcie_topology_change_list:
    Replace 1-element array with flexible array
  scsi: mpi3mr: struct mpi3_sas_io_unit_page0: Replace 1-element array
    with flexible array
  scsi: mpi3mr: struct mpi3_sas_io_unit_page1: Replace 1-element array
    with flexible array

 drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 10 ++--------
 drivers/scsi/mpi3mr/mpi/mpi30_ioc.h  | 10 ++--------
 2 files changed, 4 insertions(+), 16 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] scsi: mpi3mr: struct mpi3_event_data_sas_topology_change_list: Replace 1-element array with flexible array
  2024-07-11 15:56 [PATCH 0/4] scsi: mpi3mr: Replace 1-element arrays with flexible arrays Kees Cook
@ 2024-07-11 15:56 ` Kees Cook
  2024-07-11 16:16   ` Gustavo A. R. Silva
  2024-07-11 15:56 ` [PATCH 2/4] scsi: mpi3mr: struct mpi3_event_data_pcie_topology_change_list: " Kees Cook
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Kees Cook @ 2024-07-11 15:56 UTC (permalink / raw)
  To: Sathya Prakash Veerichetty
  Cc: Kees Cook, Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Martin K. Petersen, Gustavo A. R. Silva,
	Ranjan Kumar, Stephen Rothwell, mpi3mr-linuxdrv.pdl, linux-scsi,
	linux-hardening, linux-kernel

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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] scsi: mpi3mr: struct mpi3_event_data_pcie_topology_change_list: Replace 1-element array with flexible array
  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 15:56 ` 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
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Kees Cook @ 2024-07-11 15:56 UTC (permalink / raw)
  To: Sathya Prakash Veerichetty
  Cc: Kees Cook, Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Martin K. Petersen, Gustavo A. R. Silva,
	Ranjan Kumar, Stephen Rothwell, mpi3mr-linuxdrv.pdl, linux-scsi,
	linux-hardening, linux-kernel

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@kernel.org>
---
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 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)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page0: Replace 1-element array with flexible array
  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 15:56 ` [PATCH 2/4] scsi: mpi3mr: struct mpi3_event_data_pcie_topology_change_list: " Kees Cook
@ 2024-07-11 15:56 ` 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
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Kees Cook @ 2024-07-11 15:56 UTC (permalink / raw)
  To: Sathya Prakash Veerichetty
  Cc: Kees Cook, Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Martin K. Petersen, Ranjan Kumar,
	mpi3mr-linuxdrv.pdl, linux-scsi, Gustavo A. R. Silva,
	Stephen Rothwell, linux-kernel, linux-hardening

Replace the deprecated[1] use of a 1-element array in
struct mpi3_sas_io_unit_page0 with a modern flexible array.

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>
---
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: Ranjan Kumar <ranjan.kumar@broadcom.com>
Cc: mpi3mr-linuxdrv.pdl@broadcom.com
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
index 6a19e17eb1a7..66cca35d8e52 100644
--- a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
+++ b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
@@ -1565,16 +1565,13 @@ struct mpi3_sas_io_unit0_phy_data {
 	__le32             reserved10;
 };
 
-#ifndef MPI3_SAS_IO_UNIT0_PHY_MAX
-#define MPI3_SAS_IO_UNIT0_PHY_MAX           (1)
-#endif
 struct mpi3_sas_io_unit_page0 {
 	struct mpi3_config_page_header         header;
 	__le32                             reserved08;
 	u8                                 num_phys;
 	u8                                 init_status;
 	__le16                             reserved0e;
-	struct mpi3_sas_io_unit0_phy_data      phy_data[MPI3_SAS_IO_UNIT0_PHY_MAX];
+	struct mpi3_sas_io_unit0_phy_data      phy_data[];
 };
 
 #define MPI3_SASIOUNIT0_PAGEVERSION                          (0x00)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page1: Replace 1-element array with flexible array
  2024-07-11 15:56 [PATCH 0/4] scsi: mpi3mr: Replace 1-element arrays with flexible arrays Kees Cook
                   ` (2 preceding siblings ...)
  2024-07-11 15:56 ` [PATCH 3/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page0: " Kees Cook
@ 2024-07-11 15:56 ` 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
  5 siblings, 1 reply; 11+ messages in thread
From: Kees Cook @ 2024-07-11 15:56 UTC (permalink / raw)
  To: Sathya Prakash Veerichetty
  Cc: Kees Cook, Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Martin K. Petersen, Ranjan Kumar,
	mpi3mr-linuxdrv.pdl, linux-scsi, Gustavo A. R. Silva,
	Stephen Rothwell, linux-kernel, linux-hardening

Replace the deprecated[1] use of a 1-element array in
struct mpi3_sas_io_unit_page1 with a modern flexible array.

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>
---
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: Ranjan Kumar <ranjan.kumar@broadcom.com>
Cc: mpi3mr-linuxdrv.pdl@broadcom.com
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
index 66cca35d8e52..4b7a8f6314a3 100644
--- a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
+++ b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
@@ -1603,9 +1603,6 @@ struct mpi3_sas_io_unit1_phy_data {
 	__le32             reserved08;
 };
 
-#ifndef MPI3_SAS_IO_UNIT1_PHY_MAX
-#define MPI3_SAS_IO_UNIT1_PHY_MAX           (1)
-#endif
 struct mpi3_sas_io_unit_page1 {
 	struct mpi3_config_page_header         header;
 	__le16                             control_flags;
@@ -1615,7 +1612,7 @@ struct mpi3_sas_io_unit_page1 {
 	u8                                 num_phys;
 	u8                                 sata_max_q_depth;
 	__le16                             reserved12;
-	struct mpi3_sas_io_unit1_phy_data      phy_data[MPI3_SAS_IO_UNIT1_PHY_MAX];
+	struct mpi3_sas_io_unit1_phy_data      phy_data[];
 };
 
 #define MPI3_SASIOUNIT1_PAGEVERSION                                 (0x00)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] scsi: mpi3mr: struct mpi3_event_data_sas_topology_change_list: Replace 1-element array with flexible array
  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
  0 siblings, 0 replies; 11+ messages in thread
From: Gustavo A. R. Silva @ 2024-07-11 16:16 UTC (permalink / raw)
  To: Kees Cook, Sathya Prakash Veerichetty
  Cc: Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Martin K. Petersen, Gustavo A. R. Silva,
	Ranjan Kumar, Stephen Rothwell, mpi3mr-linuxdrv.pdl, linux-scsi,
	linux-hardening, linux-kernel



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)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] scsi: mpi3mr: struct mpi3_event_data_pcie_topology_change_list: Replace 1-element array with flexible array
  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
  0 siblings, 0 replies; 11+ messages in thread
From: Gustavo A. R. Silva @ 2024-07-11 16:17 UTC (permalink / raw)
  To: Kees Cook, Sathya Prakash Veerichetty
  Cc: Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Martin K. Petersen, Gustavo A. R. Silva,
	Ranjan Kumar, Stephen Rothwell, mpi3mr-linuxdrv.pdl, linux-scsi,
	linux-hardening, linux-kernel



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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page0: Replace 1-element array with flexible array
  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
  0 siblings, 0 replies; 11+ messages in thread
From: Gustavo A. R. Silva @ 2024-07-11 16:18 UTC (permalink / raw)
  To: Kees Cook, Sathya Prakash Veerichetty
  Cc: Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Martin K. Petersen, Ranjan Kumar,
	mpi3mr-linuxdrv.pdl, linux-scsi, Gustavo A. R. Silva,
	Stephen Rothwell, linux-kernel, linux-hardening



On 11/07/24 09:56, Kees Cook wrote:
> Replace the deprecated[1] use of a 1-element array in
> struct mpi3_sas_io_unit_page0 with a modern flexible array.
> 
> 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: Ranjan Kumar <ranjan.kumar@broadcom.com>
> Cc: mpi3mr-linuxdrv.pdl@broadcom.com
> Cc: linux-scsi@vger.kernel.org
> ---
>   drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
> index 6a19e17eb1a7..66cca35d8e52 100644
> --- a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
> +++ b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
> @@ -1565,16 +1565,13 @@ struct mpi3_sas_io_unit0_phy_data {
>   	__le32             reserved10;
>   };
>   
> -#ifndef MPI3_SAS_IO_UNIT0_PHY_MAX
> -#define MPI3_SAS_IO_UNIT0_PHY_MAX           (1)
> -#endif
>   struct mpi3_sas_io_unit_page0 {
>   	struct mpi3_config_page_header         header;
>   	__le32                             reserved08;
>   	u8                                 num_phys;
>   	u8                                 init_status;
>   	__le16                             reserved0e;
> -	struct mpi3_sas_io_unit0_phy_data      phy_data[MPI3_SAS_IO_UNIT0_PHY_MAX];
> +	struct mpi3_sas_io_unit0_phy_data      phy_data[];
>   };
>   
>   #define MPI3_SASIOUNIT0_PAGEVERSION                          (0x00)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page1: Replace 1-element array with flexible array
  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
  0 siblings, 0 replies; 11+ messages in thread
From: Gustavo A. R. Silva @ 2024-07-11 16:25 UTC (permalink / raw)
  To: Kees Cook, Sathya Prakash Veerichetty
  Cc: Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Martin K. Petersen, Ranjan Kumar,
	mpi3mr-linuxdrv.pdl, linux-scsi, Gustavo A. R. Silva,
	Stephen Rothwell, linux-kernel, linux-hardening



On 11/07/24 09:56, Kees Cook wrote:
> Replace the deprecated[1] use of a 1-element array in
> struct mpi3_sas_io_unit_page1 with a modern flexible array.
> 
> 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: Ranjan Kumar <ranjan.kumar@broadcom.com>
> Cc: mpi3mr-linuxdrv.pdl@broadcom.com
> Cc: linux-scsi@vger.kernel.org
> ---
>   drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
> index 66cca35d8e52..4b7a8f6314a3 100644
> --- a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
> +++ b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
> @@ -1603,9 +1603,6 @@ struct mpi3_sas_io_unit1_phy_data {
>   	__le32             reserved08;
>   };
>   
> -#ifndef MPI3_SAS_IO_UNIT1_PHY_MAX
> -#define MPI3_SAS_IO_UNIT1_PHY_MAX           (1)
> -#endif
>   struct mpi3_sas_io_unit_page1 {
>   	struct mpi3_config_page_header         header;
>   	__le16                             control_flags;
> @@ -1615,7 +1612,7 @@ struct mpi3_sas_io_unit_page1 {
>   	u8                                 num_phys;
>   	u8                                 sata_max_q_depth;
>   	__le16                             reserved12;
> -	struct mpi3_sas_io_unit1_phy_data      phy_data[MPI3_SAS_IO_UNIT1_PHY_MAX];
> +	struct mpi3_sas_io_unit1_phy_data      phy_data[];
>   };
>   
>   #define MPI3_SASIOUNIT1_PAGEVERSION                                 (0x00)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/4] scsi: mpi3mr: Replace 1-element arrays with flexible arrays
  2024-07-11 15:56 [PATCH 0/4] scsi: mpi3mr: Replace 1-element arrays with flexible arrays Kees Cook
                   ` (3 preceding siblings ...)
  2024-07-11 15:56 ` [PATCH 4/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page1: " Kees Cook
@ 2024-08-03  1:24 ` Martin K. Petersen
  2024-08-05 21:17 ` Martin K. Petersen
  5 siblings, 0 replies; 11+ messages in thread
From: Martin K. Petersen @ 2024-08-03  1:24 UTC (permalink / raw)
  To: Kees Cook
  Cc: Sathya Prakash Veerichetty, Kashyap Desai, Sumit Saxena,
	Sreekanth Reddy, James E.J. Bottomley, Martin K. Petersen,
	Gustavo A. R. Silva, Ranjan Kumar, Stephen Rothwell, linux-kernel,
	mpi3mr-linuxdrv.pdl, linux-scsi, linux-hardening


Kees,

> Replace all the uses of deprecated 1-element "fake" flexible arrays
> with modern C99 flexible arrays.

Applied to 6.12/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/4] scsi: mpi3mr: Replace 1-element arrays with flexible arrays
  2024-07-11 15:56 [PATCH 0/4] scsi: mpi3mr: Replace 1-element arrays with flexible arrays Kees Cook
                   ` (4 preceding siblings ...)
  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
  5 siblings, 0 replies; 11+ messages in thread
From: Martin K. Petersen @ 2024-08-05 21:17 UTC (permalink / raw)
  To: Sathya Prakash Veerichetty, Kees Cook
  Cc: Martin K . Petersen, Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
	James E.J. Bottomley, Gustavo A. R. Silva, Ranjan Kumar,
	Stephen Rothwell, linux-kernel, mpi3mr-linuxdrv.pdl, linux-scsi,
	linux-hardening

On Thu, 11 Jul 2024 08:56:32 -0700, Kees Cook wrote:

> Replace all the uses of deprecated 1-element "fake" flexible arrays
> with modern C99 flexible arrays.
> 
> Thanks!
> 
> -Kees
> 
> [...]

Applied to 6.12/scsi-queue, thanks!

[1/4] scsi: mpi3mr: struct mpi3_event_data_sas_topology_change_list: Replace 1-element array with flexible array
      https://git.kernel.org/mkp/scsi/c/ac5b7505de70
[2/4] scsi: mpi3mr: struct mpi3_event_data_pcie_topology_change_list: Replace 1-element array with flexible array
      https://git.kernel.org/mkp/scsi/c/0e11f97bfddc
[3/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page0: Replace 1-element array with flexible array
      https://git.kernel.org/mkp/scsi/c/41bb96296f9d
[4/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page1: Replace 1-element array with flexible array
      https://git.kernel.org/mkp/scsi/c/a62193abae75

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-08-05 21:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox