Skip to content

Commit

Permalink
xen/privcmd: return -EFAULT on error
Browse files Browse the repository at this point in the history
__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>
  • Loading branch information
Dan Carpenter authored and Konrad Rzeszutek Wilk committed Sep 10, 2012
1 parent 1714df7 commit 9d2be92
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/xen/privcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,11 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
state.err = err_array;
ret = traverse_pages(m.num, sizeof(xen_pfn_t),
&pagelist, mmap_return_errors_v1, &state);
} else if (version == 2)
} else if (version == 2) {
ret = __copy_to_user(m.err, err_array, m.num * sizeof(int));
if (ret)
ret = -EFAULT;
}

/* If we have not had any EFAULT-like global errors then set the global
* error to -ENOENT if necessary. */
Expand Down

0 comments on commit 9d2be92

Please sign in to comment.