Commit 12f0258d authored by Dan Carpenter's avatar Dan Carpenter Committed by Konrad Rzeszutek Wilk

xen-gntdev: return -EFAULT on copy_to_user failure

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.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 804f1853
...@@ -273,7 +273,7 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages) ...@@ -273,7 +273,7 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
map->vma->vm_start + map->notify.addr; map->vma->vm_start + map->notify.addr;
err = copy_to_user(tmp, &err, 1); err = copy_to_user(tmp, &err, 1);
if (err) if (err)
return err; return -EFAULT;
map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE; map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
} else if (pgno >= offset && pgno < offset + pages) { } else if (pgno >= offset && pgno < offset + pages) {
uint8_t *tmp = kmap(map->pages[pgno]); uint8_t *tmp = kmap(map->pages[pgno]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment