aic79xx: use kmemdup
Subsystems (3)
PATCH 1/1 aic79xx: use kmemdup
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.
--- drivers/scsi/aic7xxx/aic79xx_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aic7xxx/aic79xx_core.c +2 -2
@@ -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 );
Signature · 1 line
1.9.1
PATCH 1/1 aic7xxx: use kmemdup
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.
--- drivers/scsi/aic7xxx/aic7xxx_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aic7xxx/aic7xxx_core.c +2 -2
@@ -6940,10 +6940,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 );
Signature · 1 line
1.9.1
PATCH 1/1 aacraid: use kmemdup
In reply to Muhammad Falak R WaniUse 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.
--- drivers/scsi/aacraid/commctrl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/aacraid/commctrl.c +3 -4
@@ -635,15 +635,14 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) } }else {struct user_sgmap * usg; - usg =kmalloc (actual_fibsize -sizeof (struct aac_srb ) - +sizeof (struct sgmap ),GFP_KERNEL ); + usg =kmemdup (upsg, + actual_fibsize -sizeof (struct aac_srb ) + +sizeof (struct sgmap ),GFP_KERNEL );if (!usg) {dprintk ((KERN_DEBUG "aacraid: Allocation error in Raw SRB command\n" )); rcode = -ENOMEM ; goto cleanup; } -memcpy (usg, upsg, actual_fibsize -sizeof (struct aac_srb ) - +sizeof (struct sgmap )); actual_fibsize = actual_fibsize64;for (i =0 ; i < usg->count; i++) {
Signature · 1 line
1.9.1
RE: [PATCH] [SCSI] aacraid: use kmemdup
Quoted 46 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Muhammad Falak R Wani
Sent: Thursday, May 19, 2016 7:09 AM
To: Hannes Reinecke
Cc: Adaptec OEM Raid Solutions; James E.J. Bottomley; Martin K. Petersen; [email protected]; [email protected]
Subject: [PATCH] [SCSI] aacraid: use kmemdupEXTERNAL EMAIL
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 <[email protected]>--- drivers/scsi/aacraid/commctrl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/scsi/aacraid/commctrl.c +3
-4@@ -635,15 +635,14 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) } }else {struct user_sgmap * usg; - usg =kmalloc (actual_fibsize -sizeof (struct aac_srb ) - +sizeof (struct sgmap ),GFP_KERNEL ); + usg =kmemdup (upsg, + actual_fibsize -sizeof (struct aac_srb ) + +sizeof (struct sgmap ),GFP_KERNEL );if (!usg) {dprintk ((KERN_DEBUG "aacraid: Allocation error in Raw SRB command\n")); rcode = -ENOMEM ; goto cleanup; } -memcpy (usg, upsg, actual_fibsize -sizeof (struct aac_srb ) - +sizeof (struct sgmap )); actual_fibsize = actual_fibsize64;
Quoted 1 line
for (i = 0; i < usg->count; i++) {Martin K. Petersen
AppliedRe: [PATCH] [SCSI] aacraid: use kmemdup
In reply to Muhammad Falak R WaniQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Muhammad" == Muhammad Falak R Wani <[email protected]> writes:
Muhammad> Use kmemdup when some other buffer is immediately copied into Muhammad> allocated region. It replaces call to allocation followed by Muhammad> memcpy, by a single call to kmemdup.
Applied to 4.8/scsi-queue.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering