[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250205010732.16891-1-jiashengjiangcool@gmail.com>
Date: Wed, 5 Feb 2025 01:07:31 +0000
From: Jiasheng Jiang <jiashengjiangcool@...il.com>
To: markus.elfring@....de
Cc: GR-QLogic-Storage-Upstream@...vell.com,
James.Bottomley@...senpartnership.com,
arun.easi@...ium.com,
bvanassche@....org,
jhasan@...vell.com,
jiashengjiangcool@...il.com,
linux-kernel@...r.kernel.org,
linux-scsi@...r.kernel.org,
manish.rangankar@...ium.com,
martin.petersen@...cle.com,
nilesh.javali@...ium.com,
skashyap@...vell.com
Subject: [PATCH v3 1/2] scsi: qedf: Replace kmalloc_array() with kcalloc()
Replace kmalloc_array() with kcalloc() to avoid old (dirty) data being
used/freed.
Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
---
Changelog:
v2 -> v3:
1. Remove the check for bdt_info.
v1 -> v2:
1. Replace kzalloc() with kcalloc().
---
drivers/scsi/qedf/qedf_io.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c
index fcfc3bed02c6..d52057b97a4f 100644
--- a/drivers/scsi/qedf/qedf_io.c
+++ b/drivers/scsi/qedf/qedf_io.c
@@ -254,9 +254,7 @@ struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf)
}
/* Allocate pool of io_bdts - one for each qedf_ioreq */
- cmgr->io_bdt_pool = kmalloc_array(num_ios, sizeof(struct io_bdt *),
- GFP_KERNEL);
-
+ cmgr->io_bdt_pool = kcalloc(num_ios, sizeof(*cmgr->io_bdt_pool), GFP_KERNEL);
if (!cmgr->io_bdt_pool) {
QEDF_WARN(&(qedf->dbg_ctx), "Failed to alloc io_bdt_pool.\n");
goto mem_err;
--
2.25.1
Powered by blists - more mailing lists