From: Aliasgar Surti <aliasgar.surti...@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.surti...@gmail.com>
---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c 
b/drivers/scsi/aic7xxx/aic7xxx_core.c
index a9d40d3b90ef..295503d27332 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -6907,10 +6907,10 @@ ahc_loadseq(struct ahc_softc *ahc)
        if (cs_count != 0) {
 
                cs_count *= sizeof(struct cs);
-               ahc->critical_sections = kmalloc(cs_count, GFP_ATOMIC);
+               ahc->critical_sections = kmemdup(cs_table, cs_count,
+                                                GFP_ATOMIC);
                if (ahc->critical_sections == NULL)
                        panic("ahc_loadseq: Could not malloc");
-               memcpy(ahc->critical_sections, cs_table, cs_count);
        }
        ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS|FASTMODE);
 
-- 
2.17.1

Reply via email to