summaryrefslogtreecommitdiff
path: root/linux/i810_bufs.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/i810_bufs.c')
-rw-r--r--linux/i810_bufs.c70
1 files changed, 34 insertions, 36 deletions
diff --git a/linux/i810_bufs.c b/linux/i810_bufs.c
index fa1f84dc..a999e96b 100644
--- a/linux/i810_bufs.c
+++ b/linux/i810_bufs.c
@@ -56,10 +56,10 @@ int i810_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd,
if (!dma) return -EINVAL;
- copy_from_user_ret(&request,
+ if (copy_from_user(&request,
(drm_buf_desc_t *)arg,
- sizeof(request),
- -EFAULT);
+ sizeof(request)))
+ return -EFAULT;
count = request.count;
order = drm_order(request.size);
@@ -155,10 +155,10 @@ int i810_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd,
request.count = entry->buf_count;
request.size = size;
- copy_to_user_ret((drm_buf_desc_t *)arg,
+ if (copy_to_user((drm_buf_desc_t *)arg,
&request,
- sizeof(request),
- -EFAULT);
+ sizeof(request)))
+ return -EFAULT;
atomic_dec(&dev->buf_alloc);
dma->flags = _DRM_DMA_USE_AGP;
@@ -170,10 +170,10 @@ int i810_addbufs(struct inode *inode, struct file *filp, unsigned int cmd,
{
drm_buf_desc_t request;
- copy_from_user_ret(&request,
+ if (copy_from_user(&request,
(drm_buf_desc_t *)arg,
- sizeof(request),
- -EFAULT);
+ sizeof(request)))
+ return -EFAULT;
if(request.flags & _DRM_AGP_BUFFER)
return i810_addbufs_agp(inode, filp, cmd, arg);
@@ -201,10 +201,10 @@ int i810_infobufs(struct inode *inode, struct file *filp, unsigned int cmd,
++dev->buf_use; /* Can't allocate more after this call */
spin_unlock(&dev->count_lock);
- copy_from_user_ret(&request,
+ if (copy_from_user(&request,
(drm_buf_info_t *)arg,
- sizeof(request),
- -EFAULT);
+ sizeof(request)))
+ return -EFAULT;
for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) {
if (dma->bufs[i].buf_count) ++count;
@@ -215,28 +215,26 @@ int i810_infobufs(struct inode *inode, struct file *filp, unsigned int cmd,
if (request.count >= count) {
for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) {
if (dma->bufs[i].buf_count) {
- copy_to_user_ret(&request.list[count].count,
+ if (copy_to_user(&request.list[count].count,
&dma->bufs[i].buf_count,
sizeof(dma->bufs[0]
- .buf_count),
- -EFAULT);
- copy_to_user_ret(&request.list[count].size,
+ .buf_count)) ||
+ copy_to_user(&request.list[count].size,
&dma->bufs[i].buf_size,
- sizeof(dma->bufs[0].buf_size),
- -EFAULT);
- copy_to_user_ret(&request.list[count].low_mark,
+ sizeof(dma->bufs[0].buf_size)) ||
+ copy_to_user(&request.list[count].low_mark,
&dma->bufs[i]
.freelist.low_mark,
sizeof(dma->bufs[0]
- .freelist.low_mark),
- -EFAULT);
- copy_to_user_ret(&request.list[count]
+ .freelist.low_mark)) ||
+ copy_to_user(&request.list[count]
.high_mark,
&dma->bufs[i]
.freelist.high_mark,
sizeof(dma->bufs[0]
- .freelist.high_mark),
- -EFAULT);
+ .freelist.high_mark)))
+ return -EFAULT;
+
DRM_DEBUG("%d %d %d %d %d\n",
i,
dma->bufs[i].buf_count,
@@ -249,10 +247,10 @@ int i810_infobufs(struct inode *inode, struct file *filp, unsigned int cmd,
}
request.count = count;
- copy_to_user_ret((drm_buf_info_t *)arg,
+ if (copy_to_user((drm_buf_info_t *)arg,
&request,
- sizeof(request),
- -EFAULT);
+ sizeof(request)))
+ return -EFAULT;
return 0;
}
@@ -269,10 +267,10 @@ int i810_markbufs(struct inode *inode, struct file *filp, unsigned int cmd,
if (!dma) return -EINVAL;
- copy_from_user_ret(&request,
+ if (copy_from_user(&request,
(drm_buf_desc_t *)arg,
- sizeof(request),
- -EFAULT);
+ sizeof(request)))
+ return -EFAULT;
DRM_DEBUG("%d, %d, %d\n",
request.size, request.low_mark, request.high_mark);
@@ -304,17 +302,17 @@ int i810_freebufs(struct inode *inode, struct file *filp, unsigned int cmd,
if (!dma) return -EINVAL;
- copy_from_user_ret(&request,
+ if (copy_from_user(&request,
(drm_buf_free_t *)arg,
- sizeof(request),
- -EFAULT);
+ sizeof(request)))
+ return -EFAULT;
DRM_DEBUG("%d\n", request.count);
for (i = 0; i < request.count; i++) {
- copy_from_user_ret(&idx,
+ if (copy_from_user(&idx,
&request.list[i],
- sizeof(idx),
- -EFAULT);
+ sizeof(idx)))
+ return -EFAULT;
if (idx < 0 || idx >= dma->buf_count) {
DRM_ERROR("Index %d (of %d max)\n",
idx, dma->buf_count - 1);