* [PATCH] [SCSI] aic79xx: use kmemdup
@ 2016-05-19 14:08 Muhammad Falak R Wani
2016-05-19 14:08 ` [PATCH] [SCSI] aic7xxx: " Muhammad Falak R Wani
2016-05-19 14:08 ` [PATCH] [SCSI] aacraid: " Muhammad Falak R Wani
0 siblings, 2 replies; 5+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-19 14:08 UTC (permalink / raw)
To: Hannes Reinecke
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] [SCSI] aic7xxx: use kmemdup
2016-05-19 14:08 [PATCH] [SCSI] aic79xx: use kmemdup Muhammad Falak R Wani
@ 2016-05-19 14:08 ` Muhammad Falak R Wani
2016-05-19 14:08 ` [PATCH] [SCSI] aacraid: " Muhammad Falak R Wani
1 sibling, 0 replies; 5+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-19 14:08 UTC (permalink / raw)
To: Hannes Reinecke
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel
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/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 64ab9ea..2672c39 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -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);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] [SCSI] aacraid: use kmemdup
2016-05-19 14:08 [PATCH] [SCSI] aic79xx: use kmemdup Muhammad Falak R Wani
2016-05-19 14:08 ` [PATCH] [SCSI] aic7xxx: " Muhammad Falak R Wani
@ 2016-05-19 14:08 ` Muhammad Falak R Wani
2016-05-19 18:25 ` Raghava Aditya Renukunta
2016-06-01 2:24 ` Martin K. Petersen
1 sibling, 2 replies; 5+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-19 14:08 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Adaptec OEM Raid Solutions, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, linux-kernel
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/aacraid/commctrl.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 4b3bb52..b381b37 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -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++) {
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH] [SCSI] aacraid: use kmemdup
2016-05-19 14:08 ` [PATCH] [SCSI] aacraid: " Muhammad Falak R Wani
@ 2016-05-19 18:25 ` Raghava Aditya Renukunta
2016-06-01 2:24 ` Martin K. Petersen
1 sibling, 0 replies; 5+ messages in thread
From: Raghava Aditya Renukunta @ 2016-05-19 18:25 UTC (permalink / raw)
To: Muhammad Falak R Wani, Hannes Reinecke
Cc: Adaptec OEM Raid Solutions, James E.J. Bottomley,
Martin K. Petersen, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
> owner@vger.kernel.org] 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;
> linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] [SCSI] aacraid: use kmemdup
>
> EXTERNAL 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 <falakreyaz@gmail.com>
> ---
> drivers/scsi/aacraid/commctrl.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
> index 4b3bb52..b381b37 100644
> --- a/drivers/scsi/aacraid/commctrl.c
> +++ b/drivers/scsi/aacraid/commctrl.c
> @@ -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++) {
Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [SCSI] aacraid: use kmemdup
2016-05-19 14:08 ` [PATCH] [SCSI] aacraid: " Muhammad Falak R Wani
2016-05-19 18:25 ` Raghava Aditya Renukunta
@ 2016-06-01 2:24 ` Martin K. Petersen
1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2016-06-01 2:24 UTC (permalink / raw)
To: Muhammad Falak R Wani
Cc: Hannes Reinecke, Adaptec OEM Raid Solutions, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, linux-kernel,
Raghava Aditya Renukunta
>>>>> "Muhammad" == Muhammad Falak R Wani <falakreyaz@gmail.com> 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.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-01 2:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-19 14:08 [PATCH] [SCSI] aic79xx: use kmemdup Muhammad Falak R Wani
2016-05-19 14:08 ` [PATCH] [SCSI] aic7xxx: " Muhammad Falak R Wani
2016-05-19 14:08 ` [PATCH] [SCSI] aacraid: " Muhammad Falak R Wani
2016-05-19 18:25 ` Raghava Aditya Renukunta
2016-06-01 2:24 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).