VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / char / drm / gamma_dma.c
index ed6a835..7802f51 100644 (file)
@@ -565,9 +565,10 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd,
        drm_device_t      *dev      = priv->dev;
        drm_device_dma_t  *dma      = dev->dma;
        int               retcode   = 0;
+       drm_dma_t         __user *argp = (void __user *)arg;
        drm_dma_t         d;
 
-       if (copy_from_user(&d, (drm_dma_t *)arg, sizeof(d)))
+       if (copy_from_user(&d, argp, sizeof(d)))
                return -EFAULT;
 
        if (d.send_count < 0 || d.send_count > dma->buf_count) {
@@ -597,7 +598,7 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd,
 
        DRM_DEBUG("%d returning, granted = %d\n",
                  current->pid, d.granted_count);
-       if (copy_to_user((drm_dma_t *)arg, &d, sizeof(d)))
+       if (copy_to_user(argp, &d, sizeof(d)))
                return -EFAULT;
 
        return retcode;
@@ -720,7 +721,7 @@ int gamma_dma_init( struct inode *inode, struct file *filp,
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       if ( copy_from_user( &init, (drm_gamma_init_t *)arg, sizeof(init) ) )
+       if ( copy_from_user( &init, (drm_gamma_init_t __user *)arg, sizeof(init) ) )
                return -EFAULT;
 
        switch ( init.func ) {
@@ -789,7 +790,7 @@ int gamma_dma_copy( struct inode *inode, struct file *filp,
        drm_device_t *dev = priv->dev;
        drm_gamma_copy_t copy;
 
-       if ( copy_from_user( &copy, (drm_gamma_copy_t *)arg, sizeof(copy) ) )
+       if ( copy_from_user( &copy, (drm_gamma_copy_t __user *)arg, sizeof(copy) ) )
                return -EFAULT;
 
        return gamma_do_copy_dma( dev, &copy );
@@ -804,12 +805,11 @@ int gamma_getsareactx(struct inode *inode, struct file *filp,
 {
        drm_file_t      *priv   = filp->private_data;
        drm_device_t    *dev    = priv->dev;
+       drm_ctx_priv_map_t __user *argp = (void __user *)arg;
        drm_ctx_priv_map_t request;
        drm_map_t *map;
 
-       if (copy_from_user(&request,
-                          (drm_ctx_priv_map_t *)arg,
-                          sizeof(request)))
+       if (copy_from_user(&request, argp, sizeof(request)))
                return -EFAULT;
 
        down(&dev->struct_sem);
@@ -822,7 +822,7 @@ int gamma_getsareactx(struct inode *inode, struct file *filp,
        up(&dev->struct_sem);
 
        request.handle = map->handle;
-       if (copy_to_user((drm_ctx_priv_map_t *)arg, &request, sizeof(request)))
+       if (copy_to_user(argp, &request, sizeof(request)))
                return -EFAULT;
        return 0;
 }
@@ -838,7 +838,7 @@ int gamma_setsareactx(struct inode *inode, struct file *filp,
        struct list_head *list;
 
        if (copy_from_user(&request,
-                          (drm_ctx_priv_map_t *)arg,
+                          (drm_ctx_priv_map_t __user *)arg,
                           sizeof(request)))
                return -EFAULT;