aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/xen/gntdev/gntdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/xen/gntdev/gntdev.c')
-rw-r--r--sys/dev/xen/gntdev/gntdev.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/xen/gntdev/gntdev.c b/sys/dev/xen/gntdev/gntdev.c
index a9b69ba1605e..4530feb1c76d 100644
--- a/sys/dev/xen/gntdev/gntdev.c
+++ b/sys/dev/xen/gntdev/gntdev.c
@@ -383,6 +383,13 @@ gntdev_alloc_gref(struct ioctl_gntdev_alloc_gref *arg)
}
}
+ /* Copy the output values. */
+ arg->index = file_offset;
+ for (i = 0; error == 0 && i < arg->count; i++) {
+ if (suword32(&arg->gref_ids[i], grefs[i].gref_id) != 0)
+ error = EFAULT;
+ }
+
if (error != 0) {
/*
* If target domain maps the gref (by guessing the gref-id),
@@ -401,11 +408,6 @@ gntdev_alloc_gref(struct ioctl_gntdev_alloc_gref *arg)
return (error);
}
- /* Copy the output values. */
- arg->index = file_offset;
- for (i = 0; i < arg->count; i++)
- suword32(&arg->gref_ids[i], grefs[i].gref_id);
-
/* Modify the per user private data. */
mtx_lock(&priv_user->user_data_lock);
for (i = 0; i < arg->count; i++)