[PATCH] scsi: fcoe:Use kmemdup() rather than kmalloc+memcpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replace calls to kmalloc followed by a memcpy with a direct 
call to kmemdup.

Signed-off-by: Kai Song <songkai01@xxxxxxxxxx>
---
 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux