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] [day] [month] [year] [list]
Message-ID: <04aa944f-c07c-1263-a17d-ac647725e2b9@huawei.com>
Date:   Wed, 12 May 2021 15:04:07 +0800
From:   Samuel Zou <zou_wei@...wei.com>
To:     Zhou Wang <wangzhou1@...ilicon.com>, <herbert@...dor.apana.org.au>,
        <davem@...emloft.net>
CC:     <linux-crypto@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] crypto: hisilicon -: switch to memdup_user_nul()

Hi,

Sorry for the mistake, I will send v2 soon.

On 2021/5/11 15:07, Zhou Wang wrote:
> On 2021/5/11 14:37, Zou Wei wrote:
>> Use memdup_user_nul() helper instead of open-coding to
>> simplify the code.
>>
>> Reported-by: Hulk Robot <hulkci@...wei.com>
>> Signed-off-by: Zou Wei <zou_wei@...wei.com>
>> ---
>>   drivers/crypto/hisilicon/qm.c | 11 ++---------
>>   1 file changed, 2 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
>> index ce439a0..83a5d30 100644
>> --- a/drivers/crypto/hisilicon/qm.c
>> +++ b/drivers/crypto/hisilicon/qm.c
>> @@ -1570,17 +1570,10 @@ static ssize_t qm_cmd_write(struct file *filp, const char __user *buffer,
>>   	if (count > QM_DBG_WRITE_LEN)
>>   		return -ENOSPC;
>>   
>> -	cmd_buf = kzalloc(count + 1, GFP_KERNEL);
>> -	if (!cmd_buf)
>> +	cmd_buf = memdup_user_nul(buffer, count);
>> +	if (IS_ERR(cmd_buf))
>>   		return -ENOMEM;
>>   
>> -	if (copy_from_user(cmd_buf, buffer, count)) {
>> -		kfree(cmd_buf);
>> -		return -EFAULT;
>> -	}
>> -
>> -	cmd_buf[count] = '\0';
>> -
>>   	cmd_buf_tmp = strchr(cmd_buf, '\n');
>>   	if (cmd_buf_tmp) {
>>   		*cmd_buf_tmp = '\0';
>>
> 
> It is fine to me, thanks!
> 
> BTW, normally we use crypto: hisilicon - switch to memdup_user_nul() as the subject line,
> just like other patches :)
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ