summaryrefslogtreecommitdiff
path: root/linux/sis_mm.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/sis_mm.c')
-rw-r--r--linux/sis_mm.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/linux/sis_mm.c b/linux/sis_mm.c
index 9a8f83ea..4c2b5a6c 100644
--- a/linux/sis_mm.c
+++ b/linux/sis_mm.c
@@ -78,7 +78,8 @@ int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
struct sis_memreq req;
int retval = 0;
- copy_from_user_ret(&fb, (drm_sis_mem_t *)arg, sizeof(fb), -EFAULT);
+ if (copy_from_user(&fb, (drm_sis_mem_t *)arg, sizeof(fb)))
+ return -EFAULT;
req.size = fb.size;
sis_malloc(&req);
@@ -98,7 +99,7 @@ int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
fb.free = 0;
}
- copy_to_user_ret((drm_sis_mem_t *)arg, &fb, sizeof(fb), -EFAULT);
+ if (copy_to_user((drm_sis_mem_t *)arg, &fb, sizeof(fb))) return -EFAULT;
DRM_DEBUG("alloc fb, size = %d, offset = %ld\n", fb.size, req.offset);
@@ -111,7 +112,8 @@ int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd,
drm_sis_mem_t fb;
int retval = 0;
- copy_from_user_ret(&fb, (drm_sis_mem_t *)arg, sizeof(fb), -EFAULT);
+ if (copy_from_user(&fb, (drm_sis_mem_t *)arg, sizeof(fb)))
+ return -EFAULT;
if(!fb.free){
return -1;
@@ -152,7 +154,8 @@ int sis_agp_init(struct inode *inode, struct file *filp, unsigned int cmd,
{
drm_sis_agp_t agp;
- copy_from_user_ret(&agp, (drm_sis_agp_t *)arg, sizeof(agp), -EFAULT);
+ if (copy_from_user(&agp, (drm_sis_agp_t *)arg, sizeof(agp)))
+ return -EFAULT;
AgpHeap = mmInit(agp.offset, agp.size);
@@ -171,7 +174,8 @@ int sis_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
if(!AgpHeap)
return -1;
- copy_from_user_ret(&agp, (drm_sis_mem_t *)arg, sizeof(agp), -EFAULT);
+ if (copy_from_user(&agp, (drm_sis_mem_t *)arg, sizeof(agp)))
+ return -EFAULT;
block = mmAllocMem(AgpHeap, agp.size, 0, 0);
if(block){
@@ -190,7 +194,7 @@ int sis_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
agp.free = 0;
}
- copy_to_user_ret((drm_sis_mem_t *)arg, &agp, sizeof(agp), -EFAULT);
+ if (copy_to_user((drm_sis_mem_t *)arg, &agp, sizeof(agp))) return -EFAULT;
DRM_DEBUG("alloc agp, size = %d, offset = %d\n", agp.size, agp.offset);
@@ -206,7 +210,8 @@ int sis_agp_free(struct inode *inode, struct file *filp, unsigned int cmd,
if(!AgpHeap)
return -1;
- copy_from_user_ret(&agp, (drm_sis_mem_t *)arg, sizeof(agp), -EFAULT);
+ if (copy_from_user(&agp, (drm_sis_mem_t *)arg, sizeof(agp)))
+ return -EFAULT;
if(!agp.free){
return -1;