WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [patch 1/2] xen-gntdev: return -EFAULT on copy_to_user f

To: Dan Carpenter <error27@xxxxxxxxx>
Subject: Re: [Xen-devel] [patch 1/2] xen-gntdev: return -EFAULT on copy_to_user failure
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Fri, 25 Mar 2011 11:04:38 -0400
Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, kernel-janitors@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 25 Mar 2011 08:06:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110319054434.GD2008@bicker>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20110319054434.GD2008@bicker>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-06-14)
On Sat, Mar 19, 2011 at 08:44:34AM +0300, Dan Carpenter wrote:
> copy_to_user() returns the amount of data remaining to be copied.  We
> want to return a negative error code here.  The upper layers just
> call WARN_ON() if we return non-zero so this doesn't change the
> behavior.  But returning -EFAULT is still cleaner.

Thank you. Will put it on rc1 train.
> 
> Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
> 
> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
> index 017ce60..b0f9e8f 100644
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -273,7 +273,7 @@ static int __unmap_grant_pages(struct grant_map *map, int 
> offset, int pages)
>                               map->vma->vm_start + map->notify.addr;
>                       err = copy_to_user(tmp, &err, 1);
>                       if (err)
> -                             return err;
> +                             return -EFAULT;
>                       map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
>               } else if (pgno >= offset && pgno < offset + pages) {
>                       uint8_t *tmp = kmap(map->pages[pgno]);
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>