Displaying 20 results from an estimated 669 matches for "copy_to_us".
Did you mean:
copy_to_user
2011 Mar 19
1
[patch 1/2] 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: Dan Carpenter <error27 at gmail.com&...
2011 Mar 19
1
[patch 1/2] 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: Dan Carpenter <error27 at gmail.com&...
2011 Mar 19
1
[patch 1/2] 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: Dan Carpenter <error27 at gmail.com&...
2005 Dec 09
0
[PATCH] If copy_to_user fails, return EFAULT
Tony Breeds and Rusty''s patches to add make check and make fullcheck
allow you to run portions of the hypervisor under valgrind. While doing
this, I noticed that there are a lot of places in dom0_ops.c that we''re
either not checking the return value of copy_to_user or returning EINVAL
instead of EFAULT.
The attach patch makes sure wherever we call copy_to_user we check for
error and return EFAULT.
Regards,
Anthony Liguor
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen...
2007 Apr 18
0
[Bridge] [PATCH] (4/11) bridge - ioctl cleanup and consolidation
...dex(args[1]);
if (dev == NULL)
return -EINVAL;
- if (cmd == BRCTL_ADD_IF)
+ if (args[0] == BRCTL_ADD_IF)
ret = br_add_if(br, dev);
else
ret = br_del_if(br, dev);
@@ -83,7 +112,7 @@
b.gc_timer_value = timer_residue(&br->gc_timer);
rcu_read_unlock();
- if (copy_to_user((void *)arg0, &b, sizeof(b)))
+ if (copy_to_user((void *)args[1], &b, sizeof(b)))
return -EFAULT;
return 0;
@@ -93,7 +122,7 @@
{
int num, *indices;
- num = arg1;
+ num = args[2];
if (num < 0)
return -EINVAL;
if (num == 0)
@@ -107,8 +136,8 @@
memset(ind...
2018 Oct 12
2
[PATCH net-next V2 6/8] vhost: packed ring support
..._wrap_counter = vq->last_avail_wrap_counter;
> + }
> break;
> case VHOST_GET_VRING_BASE:
> s.index = idx;
> s.num = vq->last_avail_idx;
> + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED))
> + s.num |= vq->last_avail_wrap_counter << 31;
> + if (copy_to_user(argp, &s, sizeof(s)))
> + r = -EFAULT;
> + break;
> + case VHOST_SET_VRING_USED_BASE:
> + /* Moving base with an active backend?
> + * You don't want to do that.
> + */
> + if (vq->private_data) {
> + r = -EBUSY;
> + break;
> + }
> + if (...
2018 Oct 12
2
[PATCH net-next V2 6/8] vhost: packed ring support
..._wrap_counter = vq->last_avail_wrap_counter;
> + }
> break;
> case VHOST_GET_VRING_BASE:
> s.index = idx;
> s.num = vq->last_avail_idx;
> + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED))
> + s.num |= vq->last_avail_wrap_counter << 31;
> + if (copy_to_user(argp, &s, sizeof(s)))
> + r = -EFAULT;
> + break;
> + case VHOST_SET_VRING_USED_BASE:
> + /* Moving base with an active backend?
> + * You don't want to do that.
> + */
> + if (vq->private_data) {
> + r = -EBUSY;
> + break;
> + }
> + if (...
2009 Sep 24
0
[Lguest] [PATCH 3/5] lguest: use PGDIR_SHIFT for PAE code to allow different PAGE_OFFSET
...---
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
> --- a/drivers/lguest/page_tables.c
> +++ b/drivers/lguest/page_tables.c
> @@ -996,11 +996,9 @@ static unsigned long setup_pagetables(st
> if (copy_to_user(&pgdir[0], &pgd, sizeof(pgd)) != 0)
> return -EFAULT;
> /*
> - * And the third PGD entry (ie. addresses 3G-4G).
> - *
> - * FIXME: This assumes that PAGE_OFFSET for the Guest is 0xC0000000.
> + * And the other PGD entry to make the linear mapping at PAGE_OFFSET...
2009 Sep 24
0
[Lguest] [PATCH 3/5] lguest: use PGDIR_SHIFT for PAE code to allow different PAGE_OFFSET
...---
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
> --- a/drivers/lguest/page_tables.c
> +++ b/drivers/lguest/page_tables.c
> @@ -996,11 +996,9 @@ static unsigned long setup_pagetables(st
> if (copy_to_user(&pgdir[0], &pgd, sizeof(pgd)) != 0)
> return -EFAULT;
> /*
> - * And the third PGD entry (ie. addresses 3G-4G).
> - *
> - * FIXME: This assumes that PAGE_OFFSET for the Guest is 0xC0000000.
> + * And the other PGD entry to make the linear mapping at PAGE_OFFSET...
2018 Oct 15
2
[PATCH net-next V2 6/8] vhost: packed ring support
...t;>> break;
>>> case VHOST_GET_VRING_BASE:
>>> s.index = idx;
>>> s.num = vq->last_avail_idx;
>>> + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED))
>>> + s.num |= vq->last_avail_wrap_counter << 31;
>>> + if (copy_to_user(argp, &s, sizeof(s)))
>>> + r = -EFAULT;
>>> + break;
>>> + case VHOST_SET_VRING_USED_BASE:
>>> + /* Moving base with an active backend?
>>> + * You don't want to do that.
>>> + */
>>> + if (vq->private_data) {
>...
2018 Oct 15
2
[PATCH net-next V2 6/8] vhost: packed ring support
...t;>> break;
>>> case VHOST_GET_VRING_BASE:
>>> s.index = idx;
>>> s.num = vq->last_avail_idx;
>>> + if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED))
>>> + s.num |= vq->last_avail_wrap_counter << 31;
>>> + if (copy_to_user(argp, &s, sizeof(s)))
>>> + r = -EFAULT;
>>> + break;
>>> + case VHOST_SET_VRING_USED_BASE:
>>> + /* Moving base with an active backend?
>>> + * You don't want to do that.
>>> + */
>>> + if (vq->private_data) {
>...
2012 Aug 30
1
[PATCH 04/11] vmci_driver.patch: VMCI device driver.
...if (handleArray)
+ arraySize = vmci_handle_arr_get_size(handleArray);
+
+ if (arraySize * sizeof(*handles) > *userBufSize)
+ return VMCI_ERROR_MORE_DATA;
+
+ *userBufSize = arraySize * sizeof(*handles);
+ if (*userBufSize)
+ *retval = copy_to_user(userBufUVA,
+ vmci_handle_arr_get_handles
+ (handleArray), *userBufSize);
+
+ return VMCI_SUCCESS;
+}
+
+/*
+ * Helper function for creating queue pair and copying the result
+ * to user memory.
+ */
+static int drv_q...
2012 Aug 30
1
[PATCH 04/11] vmci_driver.patch: VMCI device driver.
...if (handleArray)
+ arraySize = vmci_handle_arr_get_size(handleArray);
+
+ if (arraySize * sizeof(*handles) > *userBufSize)
+ return VMCI_ERROR_MORE_DATA;
+
+ *userBufSize = arraySize * sizeof(*handles);
+ if (*userBufSize)
+ *retval = copy_to_user(userBufUVA,
+ vmci_handle_arr_get_handles
+ (handleArray), *userBufSize);
+
+ return VMCI_SUCCESS;
+}
+
+/*
+ * Helper function for creating queue pair and copying the result
+ * to user memory.
+ */
+static int drv_q...
2015 Jan 26
1
[PATCH] vhost-scsi: introduce an ioctl to get the minimum tpgt
..._scsi_ioctl(struct file *f,
if (put_user(events_missed, eventsp))
return -EFAULT;
return 0;
+ case VHOST_SCSI_GET_TPGT:
+ if (copy_from_user(&backend, argp, sizeof(backend)))
+ return -EFAULT;
+ r = vhost_scsi_get_first_tpgt(vs, &backend);
+ if (r < 0)
+ return r;
+ if (copy_to_user(argp, &backend, sizeof(backend)))
+ return -EFAULT;
+ return 0;
case VHOST_GET_FEATURES:
features = VHOST_SCSI_FEATURES;
if (copy_to_user(featurep, &features, sizeof features))
diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
index bb6a5b4..5d350f7 100644
--...
2015 Jan 26
1
[PATCH] vhost-scsi: introduce an ioctl to get the minimum tpgt
..._scsi_ioctl(struct file *f,
if (put_user(events_missed, eventsp))
return -EFAULT;
return 0;
+ case VHOST_SCSI_GET_TPGT:
+ if (copy_from_user(&backend, argp, sizeof(backend)))
+ return -EFAULT;
+ r = vhost_scsi_get_first_tpgt(vs, &backend);
+ if (r < 0)
+ return r;
+ if (copy_to_user(argp, &backend, sizeof(backend)))
+ return -EFAULT;
+ return 0;
case VHOST_GET_FEATURES:
features = VHOST_SCSI_FEATURES;
if (copy_to_user(featurep, &features, sizeof features))
diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
index bb6a5b4..5d350f7 100644
--...
2005 Jul 22
1
Re: zaptel make problems
...declared with attribute warn_unused_result
/usr/src/zaptel/zaptel.c: In function `zt_common_ioctl':
/usr/src/zaptel/zaptel.c:2744: warning: ignoring return value of `copy_from_user', declared with attribute warn_unused_result
/usr/src/zaptel/zaptel.c:2804: warning: ignoring return value of `copy_to_user', declared with attribute warn_unused_result
/usr/src/zaptel/zaptel.c:2807: warning: ignoring return value of `copy_from_user', declared with attribute warn_unused_result
/usr/src/zaptel/zaptel.c:2889: warning: ignoring return value of `copy_from_user', declared with attribute warn_un...
2018 Nov 01
5
[PULL] vhost: cleanups and fixes
On Thu, Nov 1, 2018 at 4:00 PM Kees Cook <keescook at chromium.org> wrote:
>
> + memset(&rsp, 0, sizeof(rsp));
> + rsp.response = VIRTIO_SCSI_S_FUNCTION_REJECTED;
> + resp = vq->iov[out].iov_base;
> + ret = __copy_to_user(resp, &rsp, sizeof(rsp));
>
> Is it actually safe to trust that iov_base has passed an earlier
> access_ok() check here? Why not just use copy_to_user() instead?
Good point.
We really should have removed those double-underscore things ages ago.
Also, apart from the address, what a...
2018 Nov 01
5
[PULL] vhost: cleanups and fixes
On Thu, Nov 1, 2018 at 4:00 PM Kees Cook <keescook at chromium.org> wrote:
>
> + memset(&rsp, 0, sizeof(rsp));
> + rsp.response = VIRTIO_SCSI_S_FUNCTION_REJECTED;
> + resp = vq->iov[out].iov_base;
> + ret = __copy_to_user(resp, &rsp, sizeof(rsp));
>
> Is it actually safe to trust that iov_base has passed an earlier
> access_ok() check here? Why not just use copy_to_user() instead?
Good point.
We really should have removed those double-underscore things ages ago.
Also, apart from the address, what a...
2012 Jul 24
1
[PATCH] tcm_vhost: Expose ABI version via VHOST_SCSI_GET_ABI_VERSION
...t_scsi_ioctl(struct file *f, unsigned int ioctl,
return -EFAULT;
return vhost_scsi_clear_endpoint(vs, &backend);
+ case VHOST_SCSI_GET_ABI_VERSION:
+ if (copy_from_user(&backend, argp, sizeof backend))
+ return -EFAULT;
+
+ backend.abi_version = VHOST_SCSI_ABI_VERSION;
+
+ if (copy_to_user(argp, &backend, sizeof backend))
+ return -EFAULT;
+ return 0;
case VHOST_GET_FEATURES:
features = VHOST_FEATURES;
if (copy_to_user(featurep, &features, sizeof features))
diff --git a/drivers/vhost/tcm_vhost.h b/drivers/vhost/tcm_vhost.h
index e942df9..3d5378f 100644
--- a/driv...
2012 Jul 24
1
[PATCH] tcm_vhost: Expose ABI version via VHOST_SCSI_GET_ABI_VERSION
...t_scsi_ioctl(struct file *f, unsigned int ioctl,
return -EFAULT;
return vhost_scsi_clear_endpoint(vs, &backend);
+ case VHOST_SCSI_GET_ABI_VERSION:
+ if (copy_from_user(&backend, argp, sizeof backend))
+ return -EFAULT;
+
+ backend.abi_version = VHOST_SCSI_ABI_VERSION;
+
+ if (copy_to_user(argp, &backend, sizeof backend))
+ return -EFAULT;
+ return 0;
case VHOST_GET_FEATURES:
features = VHOST_FEATURES;
if (copy_to_user(featurep, &features, sizeof features))
diff --git a/drivers/vhost/tcm_vhost.h b/drivers/vhost/tcm_vhost.h
index e942df9..3d5378f 100644
--- a/driv...