mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: Use array_size() in vmalloc()
@ 2026-09-29 14:00 Michael Estner
  0 siblings, 0 replies; only message in thread
From: Michael Estner @ 2026-09-29 14:00 UTC (permalink / raw)
  To: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel
  Cc: Michael Estner

vmalloc() has no 2-factor argument form, so multiplication factors
computing its size need to be wrapped in array_size().

This issue was found with the help of Coccinelle and audited and
fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

Signed-off-by: Michael Estner <michaelestner@web.de>
---
 drivers/scsi/qla2xxx/qla_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index bb0cc71de37b8..b269407d0ef11 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -8652,7 +8652,7 @@ qla28xx_load_fw_template(scsi_qla_host_t *vha, uint32_t faddr)
 		ql_dbg(ql_dbg_init, vha, 0x01a5,
 		    "-> fwdt%u template allocate template %#x words...\n",
 		    j, risc_size);
-		fwdt->template = vmalloc(risc_size * sizeof(*dcode));
+		fwdt->template = vmalloc(array_size(risc_size, sizeof(*dcode)));
 		if (!fwdt->template) {
 			ql_log(ql_log_warn, vha, 0x01a6,
 			    "-> fwdt%u failed allocate template.\n", j);
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-29 14:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 14:00 [PATCH] scsi: qla2xxx: Use array_size() in vmalloc() Michael Estner

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®