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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 21 Oct 2021 03:15:37 +0200
From:   Michał Mirosław <mirq-linux@...e.qmqm.pl>
To:     Qing Wang <wangqing@...o.com>
Cc:     Thierry Reding <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] firmware: tegra: switch over to memdup_user()

On Mon, Oct 18, 2021 at 12:59:40AM -0700, Qing Wang wrote:
[...]
> --- a/drivers/firmware/tegra/bpmp-debugfs.c
> +++ b/drivers/firmware/tegra/bpmp-debugfs.c
> @@ -376,18 +376,11 @@ static ssize_t bpmp_debug_store(struct file *file, const char __user *buf,
>  	if (!filename)
>  		return -ENOENT;
>  
> -	databuf = kmalloc(count, GFP_KERNEL);
> -	if (!databuf)
> -		return -ENOMEM;
> -
> -	if (copy_from_user(databuf, buf, count)) {
> -		err = -EFAULT;
> -		goto free_ret;
> -	}
> +	databuf = memdup_user(buf, count);
> +	if (IS_ERR(databuf))
> +		return ERR_PTR(PTR_ERR(databuf));

ERR_PTR() is too much here.

Best Regards
Michał Mirosław

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ