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] [thread-next>] [day] [month] [year] [list]
Message-ID: <0e15f5a15a0fd5f21da99aa85fae2517e7d4487f.camel@imgtec.com>
Date: Mon, 2 Sep 2024 07:59:27 +0000
From: Frank Binns <Frank.Binns@...tec.com>
To: "tzimmermann@...e.de" <tzimmermann@...e.de>,
        Matt Coster
	<Matt.Coster@...tec.com>,
        "dri-devel@...ts.freedesktop.org"
	<dri-devel@...ts.freedesktop.org>,
        "airlied@...il.com" <airlied@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>,
        "ruanjinjie@...wei.com" <ruanjinjie@...wei.com>,
        "daniel@...ll.ch"
	<daniel@...ll.ch>,
        "mripard@...nel.org" <mripard@...nel.org>
Subject: Re: [PATCH -next] drm/imagination: Use memdup_user() helper to
 simplify code

On Sat, 2024-08-31 at 18:29 +0800, Jinjie Ruan wrote:
> Switching to memdup_user(), which combines kmalloc() and copy_from_user(),
> and it can simplfy code.
> 

Reviewed-by: Frank Binns <frank.binns@...tec.com>

> Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
> ---
>  drivers/gpu/drm/imagination/pvr_job.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_job.c b/drivers/gpu/drm/imagination/pvr_job.c
> index 78c2f3c6dce0..618503a212a7 100644
> --- a/drivers/gpu/drm/imagination/pvr_job.c
> +++ b/drivers/gpu/drm/imagination/pvr_job.c
> @@ -90,20 +90,13 @@ static int pvr_fw_cmd_init(struct pvr_device *pvr_dev, struct pvr_job *job,
>  	void *stream;
>  	int err;
>  
> -	stream = kzalloc(stream_len, GFP_KERNEL);
> -	if (!stream)
> -		return -ENOMEM;
> -
> -	if (copy_from_user(stream, u64_to_user_ptr(stream_userptr), stream_len)) {
> -		err = -EFAULT;
> -		goto err_free_stream;
> -	}
> +	stream = memdup_user(u64_to_user_ptr(stream_userptr), stream_len);
> +	if (IS_ERR(stream))
> +		return PTR_ERR(stream);
>  
>  	err = pvr_job_process_stream(pvr_dev, stream_def, stream, stream_len, job);
>  
> -err_free_stream:
>  	kfree(stream);
> -
>  	return err;
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ