* [PATCH] [SCSI] mpt2sas: Use kmemdup rather than duplicating its implementation
@ 2011-11-17 22:43 Thomas Meyer
0 siblings, 0 replies; only message in thread
From: Thomas Meyer @ 2011-11-17 22:43 UTC (permalink / raw)
To: JBottomley, linux-scsi, linux-kernel
The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c 2011-11-07 19:38:07.896921497 +0100
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c 2011-11-08 10:55:07.719539347 +0100
@@ -7372,7 +7372,7 @@ mpt2sas_scsih_event_callback(struct MPT2
return 1;
}
sz = le16_to_cpu(mpi_reply->EventDataLength) * 4;
- fw_event->event_data = kzalloc(sz, GFP_ATOMIC);
+ fw_event->event_data = kmemdup(mpi_reply->EventData, sz, GFP_ATOMIC);
if (!fw_event->event_data) {
printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__);
@@ -7380,8 +7380,6 @@ mpt2sas_scsih_event_callback(struct MPT2
return 1;
}
- memcpy(fw_event->event_data, mpi_reply->EventData,
- sz);
fw_event->ioc = ioc;
fw_event->VF_ID = mpi_reply->VF_ID;
fw_event->VP_ID = mpi_reply->VP_ID;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-11-17 22:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-17 22:43 [PATCH] [SCSI] mpt2sas: Use kmemdup rather than duplicating its implementation Thomas Meyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox