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: <92731704-8d18-77c5-7d8c-0a38f32321e4@huawei.com>
Date:   Thu, 1 Apr 2021 17:11:54 +0800
From:   Yang Yingliang <yangyingliang@...wei.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
CC:     <linux-kernel@...r.kernel.org>, <linux-staging@...ts.linux.dev>,
        <johan@...nel.org>, <elder@...nel.org>,
        <gregkh@...uxfoundation.org>
Subject: Re: [PATCH -next v2] staging: greybus: camera: Switch to
 memdup_user_nul()


On 2021/4/1 15:43, Dan Carpenter wrote:
> On Thu, Apr 01, 2021 at 11:17:52AM +0800, Yang Yingliang wrote:
>> Use memdup_user_nul() helper instead of open-coding to
>> simplify the code.
>>
>> Reported-by: Hulk Robot <hulkci@...wei.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
>> ---
>>   drivers/staging/greybus/camera.c | 13 +++----------
>>   1 file changed, 3 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
>> index b570e13394ac..2ecdc1bc5092 100644
>> --- a/drivers/staging/greybus/camera.c
>> +++ b/drivers/staging/greybus/camera.c
>> @@ -1120,16 +1120,9 @@ static ssize_t gb_camera_debugfs_write(struct file *file,
>>   	if (len > 1024)
>>   		return -EINVAL;
>>   
>> -	kbuf = kmalloc(len + 1, GFP_KERNEL);
>> -	if (!kbuf)
>> -		return -ENOMEM;
>> -
>> -	if (copy_from_user(kbuf, buf, len)) {
>> -		ret = -EFAULT;
>> -		goto done;
>> -	}
>> -
>> -	kbuf[len] = '\0';
>> +	kbuf = memdup_user_nul(buf, len);
>> +	if (IS_ERR(kbuf))
>> +		return PTR_ERR(kbuf);;
>                                      ^^
> There is an extra semi-colon here.  Checkpatch actually catches this
> sort of typo.

I will remove it, and send a v3 later.

Thanks,

Yang

>
> regards,
> dan carpenter
>
> .

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ