* [PATCH v2] scsi: Use vmemdup_user to replace the open code
@ 2018-08-13 12:43 zhong jiang
2018-08-13 14:20 ` Don.Brace
0 siblings, 1 reply; 8+ messages in thread
From: zhong jiang @ 2018-08-13 12:43 UTC (permalink / raw)
To: don.brace, jejb, martin.petersen; +Cc: linux-kernel
vmemdup_user is better than duplicating its implementation, So just
replace the open code.
The issue is detected with the help of Coccinelle.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/scsi/hpsa.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 58bb70b..666ba09e5 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6381,13 +6381,9 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
return -EINVAL;
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
- ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
- if (!ioc) {
- status = -ENOMEM;
- goto cleanup1;
- }
- if (copy_from_user(ioc, argp, sizeof(*ioc))) {
- status = -EFAULT;
+ ioc = vmemdup_user(argp, sizeof(*ioc));
+ if (IS_ERR(ioc)) {
+ status = PTR_ERR(ioc);
goto cleanup1;
}
if ((ioc->buf_size < 1) &&
@@ -6505,7 +6501,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
kfree(buff);
}
kfree(buff_size);
- kfree(ioc);
+ kvfree(ioc);
return status;
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [PATCH v2] scsi: Use vmemdup_user to replace the open code
2018-08-13 12:43 [PATCH v2] scsi: Use vmemdup_user to replace the open code zhong jiang
@ 2018-08-13 14:20 ` Don.Brace
2018-08-23 11:38 ` zhong jiang
0 siblings, 1 reply; 8+ messages in thread
From: Don.Brace @ 2018-08-13 14:20 UTC (permalink / raw)
To: zhongjiang, don.brace, jejb, martin.petersen; +Cc: linux-kernel
> -----Original Message-----
> From: zhong jiang [mailto:zhongjiang@huawei.com]
> Sent: Monday, August 13, 2018 7:43 AM
> To: don.brace@microsemi.com; jejb@linux.vnet.ibm.com;
> martin.petersen@oracle.com
> Cc: linux-kernel@vger.kernel.org
> Subject: [PATCH v2] scsi: Use vmemdup_user to replace the open code
>
> EXTERNAL EMAIL
>
>
> EXTERNAL EMAIL
>
>
> vmemdup_user is better than duplicating its implementation, So just
> replace the open code.
>
> The issue is detected with the help of Coccinelle.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Tested-by: Don Brace <don.brace@microsemi.com>
Acked-by: Don Brace <don.brace@microsemi.com>
> ---
> drivers/scsi/hpsa.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 58bb70b..666ba09e5 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -6381,13 +6381,9 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info
> *h, void __user *argp)
> return -EINVAL;
> if (!capable(CAP_SYS_RAWIO))
> return -EPERM;
> - ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
> - if (!ioc) {
> - status = -ENOMEM;
> - goto cleanup1;
> - }
> - if (copy_from_user(ioc, argp, sizeof(*ioc))) {
> - status = -EFAULT;
> + ioc = vmemdup_user(argp, sizeof(*ioc));
> + if (IS_ERR(ioc)) {
> + status = PTR_ERR(ioc);
> goto cleanup1;
> }
> if ((ioc->buf_size < 1) &&
> @@ -6505,7 +6501,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h,
> void __user *argp)
> kfree(buff);
> }
> kfree(buff_size);
> - kfree(ioc);
> + kvfree(ioc);
> return status;
> }
>
> --
> 1.7.12.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: Use vmemdup_user to replace the open code
2018-08-13 14:20 ` Don.Brace
@ 2018-08-23 11:38 ` zhong jiang
2018-09-18 15:00 ` zhong jiang
0 siblings, 1 reply; 8+ messages in thread
From: zhong jiang @ 2018-08-23 11:38 UTC (permalink / raw)
To: martin.petersen; +Cc: Don.Brace, don.brace, jejb, linux-kernel
On 2018/8/13 22:20, Don.Brace@microchip.com wrote:
>> -----Original Message-----
>> From: zhong jiang [mailto:zhongjiang@huawei.com]
>> Sent: Monday, August 13, 2018 7:43 AM
>> To: don.brace@microsemi.com; jejb@linux.vnet.ibm.com;
>> martin.petersen@oracle.com
>> Cc: linux-kernel@vger.kernel.org
>> Subject: [PATCH v2] scsi: Use vmemdup_user to replace the open code
>>
>> EXTERNAL EMAIL
>>
>>
>> EXTERNAL EMAIL
>>
>>
>> vmemdup_user is better than duplicating its implementation, So just
>> replace the open code.
>>
>> The issue is detected with the help of Coccinelle.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> Tested-by: Don Brace <don.brace@microsemi.com>
> Acked-by: Don Brace <don.brace@microsemi.com>
Thanks Don for your test and ack.
Martin , Can you pick up the patch, Thanks
Best wishes,
zhong jiang
>> ---
>> drivers/scsi/hpsa.c | 12 ++++--------
>> 1 file changed, 4 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
>> index 58bb70b..666ba09e5 100644
>> --- a/drivers/scsi/hpsa.c
>> +++ b/drivers/scsi/hpsa.c
>> @@ -6381,13 +6381,9 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info
>> *h, void __user *argp)
>> return -EINVAL;
>> if (!capable(CAP_SYS_RAWIO))
>> return -EPERM;
>> - ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
>> - if (!ioc) {
>> - status = -ENOMEM;
>> - goto cleanup1;
>> - }
>> - if (copy_from_user(ioc, argp, sizeof(*ioc))) {
>> - status = -EFAULT;
>> + ioc = vmemdup_user(argp, sizeof(*ioc));
>> + if (IS_ERR(ioc)) {
>> + status = PTR_ERR(ioc);
>> goto cleanup1;
>> }
>> if ((ioc->buf_size < 1) &&
>> @@ -6505,7 +6501,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h,
>> void __user *argp)
>> kfree(buff);
>> }
>> kfree(buff_size);
>> - kfree(ioc);
>> + kvfree(ioc);
>> return status;
>> }
>>
>> --
>> 1.7.12.4
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: Use vmemdup_user to replace the open code
2018-08-23 11:38 ` zhong jiang
@ 2018-09-18 15:00 ` zhong jiang
2018-09-18 15:09 ` Martin K. Petersen
2018-09-18 15:10 ` Greg KH
0 siblings, 2 replies; 8+ messages in thread
From: zhong jiang @ 2018-09-18 15:00 UTC (permalink / raw)
To: Greg KH; +Cc: martin.petersen, Don.Brace, don.brace, jejb, linux-kernel
Hi, Greg
Can you pick up the patch?
Thanks,
zhong jiang
On 2018/8/23 19:38, zhong jiang wrote:
> On 2018/8/13 22:20, Don.Brace@microchip.com wrote:
>>> -----Original Message-----
>>> From: zhong jiang [mailto:zhongjiang@huawei.com]
>>> Sent: Monday, August 13, 2018 7:43 AM
>>> To: don.brace@microsemi.com; jejb@linux.vnet.ibm.com;
>>> martin.petersen@oracle.com
>>> Cc: linux-kernel@vger.kernel.org
>>> Subject: [PATCH v2] scsi: Use vmemdup_user to replace the open code
>>>
>>> EXTERNAL EMAIL
>>>
>>>
>>> EXTERNAL EMAIL
>>>
>>>
>>> vmemdup_user is better than duplicating its implementation, So just
>>> replace the open code.
>>>
>>> The issue is detected with the help of Coccinelle.
>>>
>>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> Tested-by: Don Brace <don.brace@microsemi.com>
>> Acked-by: Don Brace <don.brace@microsemi.com>
> Thanks Don for your test and ack.
>
> Martin , Can you pick up the patch, Thanks
>
> Best wishes,
> zhong jiang
>>> ---
>>> drivers/scsi/hpsa.c | 12 ++++--------
>>> 1 file changed, 4 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
>>> index 58bb70b..666ba09e5 100644
>>> --- a/drivers/scsi/hpsa.c
>>> +++ b/drivers/scsi/hpsa.c
>>> @@ -6381,13 +6381,9 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info
>>> *h, void __user *argp)
>>> return -EINVAL;
>>> if (!capable(CAP_SYS_RAWIO))
>>> return -EPERM;
>>> - ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
>>> - if (!ioc) {
>>> - status = -ENOMEM;
>>> - goto cleanup1;
>>> - }
>>> - if (copy_from_user(ioc, argp, sizeof(*ioc))) {
>>> - status = -EFAULT;
>>> + ioc = vmemdup_user(argp, sizeof(*ioc));
>>> + if (IS_ERR(ioc)) {
>>> + status = PTR_ERR(ioc);
>>> goto cleanup1;
>>> }
>>> if ((ioc->buf_size < 1) &&
>>> @@ -6505,7 +6501,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h,
>>> void __user *argp)
>>> kfree(buff);
>>> }
>>> kfree(buff_size);
>>> - kfree(ioc);
>>> + kvfree(ioc);
>>> return status;
>>> }
>>>
>>> --
>>> 1.7.12.4
>>
>
>
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: Use vmemdup_user to replace the open code
2018-09-18 15:00 ` zhong jiang
@ 2018-09-18 15:09 ` Martin K. Petersen
2018-09-18 15:13 ` zhong jiang
2018-09-18 15:10 ` Greg KH
1 sibling, 1 reply; 8+ messages in thread
From: Martin K. Petersen @ 2018-09-18 15:09 UTC (permalink / raw)
To: zhong jiang
Cc: Greg KH, martin.petersen, Don.Brace, don.brace, jejb, linux-kernel
Hi Zhong,
> Can you pick up the patch?
Please submit SCSI patches to linux-scsi@vger.kernel.org so they get
tracked in patchwork.
Thank you!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: Use vmemdup_user to replace the open code
2018-09-18 15:00 ` zhong jiang
2018-09-18 15:09 ` Martin K. Petersen
@ 2018-09-18 15:10 ` Greg KH
2018-09-18 15:34 ` zhong jiang
1 sibling, 1 reply; 8+ messages in thread
From: Greg KH @ 2018-09-18 15:10 UTC (permalink / raw)
To: zhong jiang; +Cc: martin.petersen, Don.Brace, don.brace, jejb, linux-kernel
On Tue, Sep 18, 2018 at 11:00:37PM +0800, zhong jiang wrote:
> Hi, Greg
>
> Can you pick up the patch?
Nope, sorry, as before, work with the maintainers please.
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: Use vmemdup_user to replace the open code
2018-09-18 15:09 ` Martin K. Petersen
@ 2018-09-18 15:13 ` zhong jiang
0 siblings, 0 replies; 8+ messages in thread
From: zhong jiang @ 2018-09-18 15:13 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Greg KH, Don.Brace, don.brace, jejb, linux-kernel,
"linux-scsi@vger.kernel.org" ar
On 2018/9/18 23:09, Martin K. Petersen wrote:
> Hi Zhong,
>
>> Can you pick up the patch?
> Please submit SCSI patches to linux-scsi@vger.kernel.org so they get
> tracked in patchwork.
Ok, Should I resend the patch ?
Thanks,
zhong jiang
> Thank you!
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] scsi: Use vmemdup_user to replace the open code
2018-09-18 15:10 ` Greg KH
@ 2018-09-18 15:34 ` zhong jiang
0 siblings, 0 replies; 8+ messages in thread
From: zhong jiang @ 2018-09-18 15:34 UTC (permalink / raw)
To: Greg KH; +Cc: martin.petersen, Don.Brace, don.brace, jejb, linux-kernel
On 2018/9/18 23:10, Greg KH wrote:
> On Tue, Sep 18, 2018 at 11:00:37PM +0800, zhong jiang wrote:
>> Hi, Greg
>>
>> Can you pick up the patch?
> Nope, sorry, as before, work with the maintainers please.
Thank you for your reply timely .:-)
Sincerely,
zhong jiang
> greg k-h
>
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-09-18 15:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13 12:43 [PATCH v2] scsi: Use vmemdup_user to replace the open code zhong jiang
2018-08-13 14:20 ` Don.Brace
2018-08-23 11:38 ` zhong jiang
2018-09-18 15:00 ` zhong jiang
2018-09-18 15:09 ` Martin K. Petersen
2018-09-18 15:13 ` zhong jiang
2018-09-18 15:10 ` Greg KH
2018-09-18 15:34 ` zhong jiang
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).