[PATCH] scsi: qla2xxx: Use array_size() in vmalloc()
From: Michael Estner
Date: Tue Sep 29 2026 - 10:04:06 EST
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@xxxxxx>
---
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