[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20211004064058.251899-1-songkai01@inspur.com>
Date: Mon, 4 Oct 2021 14:40:58 +0800
From: Kai Song <songkai01@...pur.com>
To: <hare@...e.de>, <jejb@...ux.ibm.com>, <martin.petersen@...cle.com>
CC: <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Kai Song <songkai01@...pur.com>
Subject: [PATCH] scsi: fcoe:Use kmemdup() rather than kmalloc+memcpy
Replace calls to kmalloc followed by a memcpy with a direct
call to kmemdup.
Signed-off-by: Kai Song <songkai01@...pur.com>
---
drivers/scsi/fcoe/fcoe_ctlr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 1756a0ac6f08..37df848e7545 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -1045,11 +1045,10 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb)
if (fip->fcf_count >= FCOE_CTLR_FCF_LIMIT)
goto out;
- fcf = kmalloc(sizeof(*fcf), GFP_ATOMIC);
+ fcf = kmemdup(&new, sizeof(*fcf), GFP_ATOMIC);
if (!fcf)
goto out;
- memcpy(fcf, &new, sizeof(new));
fcf->fip = fip;
rc = fcoe_sysfs_fcf_add(fcf);
if (rc) {
--
2.27.0
Powered by blists - more mailing lists