Hi,

On 8/10/23 14:20, Ruan Jinjie wrote:
> Use memdup_user_nul() helper instead of open-coding to simplify the code.
> 
> Signed-off-by: Ruan Jinjie <ruanjin...@huawei.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> ---
>  drivers/platform/x86/thinkpad_acpi.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/platform/x86/thinkpad_acpi.c 
> b/drivers/platform/x86/thinkpad_acpi.c
> index 85772bad753e..d70c89d32534 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -908,16 +908,9 @@ static ssize_t dispatch_proc_write(struct file *file,
>       if (count > PAGE_SIZE - 1)
>               return -EINVAL;
>  
> -     kernbuf = kmalloc(count + 1, GFP_KERNEL);
> -     if (!kernbuf)
> -             return -ENOMEM;
> -
> -     if (copy_from_user(kernbuf, userbuf, count)) {
> -             kfree(kernbuf);
> -             return -EFAULT;
> -     }
> -
> -     kernbuf[count] = 0;
> +     kernbuf = memdup_user_nul(userbuf, count);
> +     if (IS_ERR(kernbuf))
> +             return PTR_ERR(kernbuf);
>       ret = ibm->write(kernbuf);
>       if (ret == 0)
>               ret = count;



_______________________________________________
ibm-acpi-devel mailing list
ibm-acpi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel

Reply via email to