Skip to contentSkip to conversation

scsi: mpi3mr: Reduce stack usage

PATCH In review Bart Van Assche 2 participants 3 messages Mar 25, 2024 – Apr 9, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: mpi3mr: Reduce stack usage

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 <[email protected]>
Fixes cb5b60894602 ("scsi: mpi3mr: Increase maximum number of PHYs to 64 from 32")
---
 drivers/scsi/mpi3mr/mpi3mr_transport.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr_transport.c +5 -1
index c0c8ab586957..0fe6f0c108e9 100644
@@ -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);
 }
 
 /**
#1 lore raw
Quoted 1 line · Bart Van Assche

Fix the following build error: [ ... ]

Please help with reviewing this patch.

Thanks,

Bart.

#2 lore raw
In reply to Bart Van Assche

Bart,

Quoted 3 lines

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()")

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering