All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: scsi: aic7xxx: made use of kmemdup
@ 2019-09-14 15:47 aliasgar.surti500
  0 siblings, 0 replies; only message in thread
From: aliasgar.surti500 @ 2019-09-14 15:47 UTC (permalink / raw)
  To: hare, jejb, martin.petersen, linux-scsi; +Cc: Aliasgar Surti

From: Aliasgar Surti <aliasgar.surti500@gmail.com>

There is usage of kmalloc following memcpy in this driver file.

Instead of using these functions, this change is made to use kmemdup
which has the same functionality.

Signed-off-by: Aliasgar Surti <aliasgar.surti500@gmail.com>
---
 drivers/scsi/aic7xxx/aic79xx_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 7e5044bf05c0..245f3132ac1c 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -9442,10 +9442,10 @@ ahd_loadseq(struct ahd_softc *ahd)
 	if (cs_count != 0) {
 
 		cs_count *= sizeof(struct cs);
-		ahd->critical_sections = kmalloc(cs_count, GFP_ATOMIC);
+		ahd->critical_sections = kmemdup(cs_table, cs_count,
+						 GFP_ATOMIC);
 		if (ahd->critical_sections == NULL)
 			panic("ahd_loadseq: Could not malloc");
-		memcpy(ahd->critical_sections, cs_table, cs_count);
 	}
 	ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-14 15:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-14 15:47 [PATCH] drivers: scsi: aic7xxx: made use of kmemdup aliasgar.surti500

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.