diff mbox series

scsi: mpi3mr: Reduce stack usage

Message ID 20240325224435.1477229-1-bvanassche@acm.org (mailing list archive)
State Not Applicable
Headers show
Series scsi: mpi3mr: Reduce stack usage | expand

Commit Message

Bart Van Assche March 25, 2024, 10:44 p.m. UTC
Fix the following build error:

drivers/scsi/mpi3mr/mpi3mr_transport.c:1818:1: error: the frame size of 1640 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Cc: Sumit Saxena <sumit.saxena@broadcom.com>
Fixes: cb5b60894602 ("scsi: mpi3mr: Increase maximum number of PHYs to 64 from 32")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/mpi3mr/mpi3mr_transport.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Bart Van Assche April 5, 2024, 7:50 p.m. UTC | #1
On 3/25/24 15:44, Bart Van Assche wrote:
> Fix the following build error: [ ... ]

Please help with reviewing this patch.

Thanks,

Bart.
Martin K. Petersen April 9, 2024, 1:48 a.m. UTC | #2
Bart,

> Fix the following build error:
>
> drivers/scsi/mpi3mr/mpi3mr_transport.c:1818:1: error: the frame size of 1640 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Already addressed by:

5cc2da0b60e5 ("scsi: mpi3mr: Reduce stack usage in mpi3mr_refresh_sas_ports()")
diff mbox series

Patch

diff --git a/drivers/scsi/mpi3mr/mpi3mr_transport.c b/drivers/scsi/mpi3mr/mpi3mr_transport.c
index c0c8ab586957..0fe6f0c108e9 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_transport.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_transport.c
@@ -1671,7 +1671,7 @@  mpi3mr_update_mr_sas_port(struct mpi3mr_ioc *mrioc, struct host_port *h_port,
 void
 mpi3mr_refresh_sas_ports(struct mpi3mr_ioc *mrioc)
 {
-	struct host_port h_port[64];
+	struct host_port *h_port;
 	int i, j, found, host_port_count = 0, port_idx;
 	u16 sz, attached_handle, ioc_status;
 	struct mpi3_sas_io_unit_page0 *sas_io_unit_pg0 = NULL;
@@ -1679,6 +1679,9 @@  mpi3mr_refresh_sas_ports(struct mpi3mr_ioc *mrioc)
 	struct mpi3_device0_sas_sata_format *sasinf;
 	struct mpi3mr_sas_port *mr_sas_port;
 
+	h_port = kcalloc(64, sizeof(*h_port), GFP_KERNEL);
+	if (!h_port)
+		goto out;
 	sz = offsetof(struct mpi3_sas_io_unit_page0, phy_data) +
 		(mrioc->sas_hba.num_phys *
 		 sizeof(struct mpi3_sas_io_unit0_phy_data));
@@ -1815,6 +1818,7 @@  mpi3mr_refresh_sas_ports(struct mpi3mr_ioc *mrioc)
 	}
 out:
 	kfree(sas_io_unit_pg0);
+	kfree(h_port);
 }
 
 /**