lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5B7E9CCE.5010007@huawei.com>
Date:   Thu, 23 Aug 2018 19:38:54 +0800
From:   zhong jiang <zhongjiang@...wei.com>
To:     <martin.petersen@...cle.com>
CC:     <Don.Brace@...rochip.com>, <don.brace@...rosemi.com>,
        <jejb@...ux.vnet.ibm.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] scsi: Use vmemdup_user to replace the open code

On 2018/8/13 22:20, Don.Brace@...rochip.com wrote:
>> -----Original Message-----
>> From: zhong jiang [mailto:zhongjiang@...wei.com]
>> Sent: Monday, August 13, 2018 7:43 AM
>> To: don.brace@...rosemi.com; jejb@...ux.vnet.ibm.com;
>> martin.petersen@...cle.com
>> Cc: linux-kernel@...r.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@...wei.com>
> Tested-by: Don Brace <don.brace@...rosemi.com>
> Acked-by: Don Brace <don.brace@...rosemi.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
>
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ