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: <2937c8c073bab2694b8f55bec62898b02ef7a07e.camel@imgtec.com>
Date: Mon, 2 Sep 2024 07:59:53 +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 v2] drm/imagination: Use memdup_user() helper

On Mon, 2024-09-02 at 10:33 +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>
> Suggested-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> v2:
> - Add suggested-by.
> - Simplify the code.
> ---
>  drivers/gpu/drm/imagination/pvr_context.c | 18 +++---------------
>  1 file changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_context.c b/drivers/gpu/drm/imagination/pvr_context.c
> index eded5e955cc0..98327f9bbd9c 100644
> --- a/drivers/gpu/drm/imagination/pvr_context.c
> +++ b/drivers/gpu/drm/imagination/pvr_context.c
> @@ -69,24 +69,12 @@ process_static_context_state(struct pvr_device *pvr_dev, const struct pvr_stream
>  	void *stream;
>  	int err;
>  
> -	stream = kzalloc(stream_size, GFP_KERNEL);
> -	if (!stream)
> -		return -ENOMEM;
> -
> -	if (copy_from_user(stream, u64_to_user_ptr(stream_user_ptr), stream_size)) {
> -		err = -EFAULT;
> -		goto err_free;
> -	}
> +	stream = memdup_user(u64_to_user_ptr(stream_user_ptr), stream_size);
> +	if (IS_ERR(stream))
> +		return PTR_ERR(stream);
>  
>  	err = pvr_stream_process(pvr_dev, cmd_defs, stream, stream_size, dest);
> -	if (err)
> -		goto err_free;
> -
> -	kfree(stream);
> -
> -	return 0;
>  
> -err_free:
>  	kfree(stream);
>  
>  	return err;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ