Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1403773 > unrolled thread

[PATCH] [SCSI] aic79xx: use kmemdup

Started byMuhammad Falak R Wani <falakreyaz@gmail.com>
First post2016-05-19 16:10 +0200
Last post2016-05-19 16:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] [SCSI] aic79xx: use kmemdup Muhammad Falak R Wani <falakreyaz@gmail.com> - 2016-05-19 16:10 +0200

#1403773 — [PATCH] [SCSI] aic79xx: use kmemdup

FromMuhammad Falak R Wani <falakreyaz@gmail.com>
Date2016-05-19 16:10 +0200
Subject[PATCH] [SCSI] aic79xx: use kmemdup
Message-ID<rAwOd-NU-7@gated-at.bofh.it>
Use kmemdup when some other buffer is immediately copied into allocated
region. It replaces call to allocation followed by memcpy, by a single
call to kmemdup.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@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 109e2c9..8592448 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -9494,10 +9494,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);
 
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web