public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiasheng Jiang <jiashengjiangcool@gmail.com>
To: markus.elfring@web.de
Cc: GR-QLogic-Storage-Upstream@marvell.com,
	James.Bottomley@hansenpartnership.com, arun.easi@cavium.com,
	bvanassche@acm.org, jhasan@marvell.com,
	jiashengjiangcool@gmail.com, linux-kernel@vger.kernel.org,
	linux-scsi@vger.kernel.org, manish.rangankar@cavium.com,
	martin.petersen@oracle.com, nilesh.javali@cavium.com,
	skashyap@marvell.com, stable@vger.kernel.org
Subject: [PATCH RESEND v3 1/2] scsi: qedf: Replace kmalloc_array() with kcalloc()
Date: Wed,  5 Feb 2025 02:01:18 +0000	[thread overview]
Message-ID: <20250205020119.24007-1-jiashengjiangcool@gmail.com> (raw)
In-Reply-To: <444d6d33-d916-467b-aea8-25c61977713a@web.de>

Replace kmalloc_array() with kcalloc() to avoid old (dirty) data being
used/freed.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Cc: <stable@vger.kernel.org> # v5.10+
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.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


  parent reply	other threads:[~2025-02-05  2:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <444d6d33-d916-467b-aea8-25c61977713a@web.de>
     [not found] ` <20250205010732.16891-1-jiashengjiangcool@gmail.com>
2025-02-05  1:07   ` [PATCH v3 2/2] scsi: qedf: Add check for bdt_info Jiasheng Jiang
2025-02-05  2:01 ` Jiasheng Jiang [this message]
2025-02-05  2:01   ` [PATCH RESEND " Jiasheng Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250205020119.24007-1-jiashengjiangcool@gmail.com \
    --to=jiashengjiangcool@gmail.com \
    --cc=GR-QLogic-Storage-Upstream@marvell.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=arun.easi@cavium.com \
    --cc=bvanassche@acm.org \
    --cc=jhasan@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=manish.rangankar@cavium.com \
    --cc=markus.elfring@web.de \
    --cc=martin.petersen@oracle.com \
    --cc=nilesh.javali@cavium.com \
    --cc=skashyap@marvell.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox