aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/privcmd.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-09-08 05:57:35 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-09-10 15:34:56 -0400
commit9d2be9287107695708e6aae5105a8a518a6cb4d0 (patch)
tree29a653d6354535842cae3c515211a5bf37da1f6b /drivers/xen/privcmd.c
parent1714df7f2cee6a741c3ed24231ec5db25b90633a (diff)
xen/privcmd: return -EFAULT on error
__copy_to_user() returns the number of bytes remaining to be copied but we want to return a negative error code here. Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen/privcmd.c')
-rw-r--r--drivers/xen/privcmd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 3b162c656205..ef6389580b8c 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -389,8 +389,11 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
389 state.err = err_array; 389 state.err = err_array;
390 ret = traverse_pages(m.num, sizeof(xen_pfn_t), 390 ret = traverse_pages(m.num, sizeof(xen_pfn_t),
391 &pagelist, mmap_return_errors_v1, &state); 391 &pagelist, mmap_return_errors_v1, &state);
392 } else if (version == 2) 392 } else if (version == 2) {
393 ret = __copy_to_user(m.err, err_array, m.num * sizeof(int)); 393 ret = __copy_to_user(m.err, err_array, m.num * sizeof(int));
394 if (ret)
395 ret = -EFAULT;
396 }
394 397
395 /* If we have not had any EFAULT-like global errors then set the global 398 /* If we have not had any EFAULT-like global errors then set the global
396 * error to -ENOENT if necessary. */ 399 * error to -ENOENT if necessary. */