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: <ed294bea-bf07-6a4d-51ec-9e7082703b61@gmail.com>
Date:   Mon, 19 Nov 2018 11:52:20 +0200
From:   Oleksandr Andrushchenko <andr2000@...il.com>
To:     Souptick Joarder <jrdr.linux@...il.com>, akpm@...ux-foundation.org,
        willy@...radead.org, mhocko@...e.com,
        oleksandr_andrushchenko@...m.com, airlied@...ux.ie
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org, xen-devel@...ts.xen.org
Subject: Re: [Xen-devel] [PATCH 5/9] drm/xen/xen_drm_front_gem.c: Convert to
 use vm_insert_range

On 11/15/18 5:49 PM, Souptick Joarder wrote:
> Convert to use vm_insert_range() to map range of kernel
> memory to user vma.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@...il.com>
> Reviewed-by: Matthew Wilcox <willy@...radead.org>
> ---
>   drivers/gpu/drm/xen/xen_drm_front_gem.c | 20 ++++++--------------
>   1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c
> index 47ff019..a3eade6 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c
> @@ -225,8 +225,7 @@ struct drm_gem_object *
>   static int gem_mmap_obj(struct xen_gem_object *xen_obj,
>   			struct vm_area_struct *vma)
>   {
> -	unsigned long addr = vma->vm_start;
> -	int i;
> +	int err;
I would love to keep ret, not err
>   
>   	/*
>   	 * clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the
> @@ -247,18 +246,11 @@ static int gem_mmap_obj(struct xen_gem_object *xen_obj,
>   	 * FIXME: as we insert all the pages now then no .fault handler must
>   	 * be called, so don't provide one
>   	 */
> -	for (i = 0; i < xen_obj->num_pages; i++) {
> -		int ret;
> -
> -		ret = vm_insert_page(vma, addr, xen_obj->pages[i]);
> -		if (ret < 0) {
> -			DRM_ERROR("Failed to insert pages into vma: %d\n", ret);
> -			return ret;
> -		}
> -
> -		addr += PAGE_SIZE;
> -	}
> -	return 0;
> +	err = vm_insert_range(vma, vma->vm_start, xen_obj->pages,
> +				xen_obj->num_pages);
> +	if (err < 0)
> +		DRM_ERROR("Failed to insert pages into vma: %d\n", err);
> +	return err;
>   }
>   
>   int xen_drm_front_gem_mmap(struct file *filp, struct vm_area_struct *vma)

With the above fixed,

Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@...m.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ