aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/vme/devices/vme_user.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index 5d3a39bcd2a..36381489b79 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -129,8 +129,9 @@ static const int type[VME_DEVS] = { MASTER_MINOR, MASTER_MINOR,
129 129
130static int vme_user_open(struct inode *, struct file *); 130static int vme_user_open(struct inode *, struct file *);
131static int vme_user_release(struct inode *, struct file *); 131static int vme_user_release(struct inode *, struct file *);
132static ssize_t vme_user_read(struct file *, char *, size_t, loff_t *); 132static ssize_t vme_user_read(struct file *, char __user *, size_t, loff_t *);
133static ssize_t vme_user_write(struct file *, const char *, size_t, loff_t *); 133static ssize_t vme_user_write(struct file *, const char __user *, size_t,
134 loff_t *);
134static loff_t vme_user_llseek(struct file *, loff_t, int); 135static loff_t vme_user_llseek(struct file *, loff_t, int);
135static long vme_user_unlocked_ioctl(struct file *, unsigned int, unsigned long); 136static long vme_user_unlocked_ioctl(struct file *, unsigned int, unsigned long);
136 137
@@ -246,7 +247,7 @@ static ssize_t resource_to_user(int minor, char __user *buf, size_t count,
246 * page) transfers will lock the user space buffer into memory and then 247 * page) transfers will lock the user space buffer into memory and then
247 * transfer the data directly from the user space buffers out to VME. 248 * transfer the data directly from the user space buffers out to VME.
248 */ 249 */
249static ssize_t resource_from_user(unsigned int minor, const char *buf, 250static ssize_t resource_from_user(unsigned int minor, const char __user *buf,
250 size_t count, loff_t *ppos) 251 size_t count, loff_t *ppos)
251{ 252{
252 ssize_t retval; 253 ssize_t retval;
@@ -293,7 +294,7 @@ static ssize_t buffer_to_user(unsigned int minor, char __user *buf,
293 return retval; 294 return retval;
294} 295}
295 296
296static ssize_t buffer_from_user(unsigned int minor, const char *buf, 297static ssize_t buffer_from_user(unsigned int minor, const char __user *buf,
297 size_t count, loff_t *ppos) 298 size_t count, loff_t *ppos)
298{ 299{
299 void *image_ptr; 300 void *image_ptr;
@@ -312,7 +313,7 @@ static ssize_t buffer_from_user(unsigned int minor, const char *buf,
312 return retval; 313 return retval;
313} 314}
314 315
315static ssize_t vme_user_read(struct file *file, char *buf, size_t count, 316static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count,
316 loff_t *ppos) 317 loff_t *ppos)
317{ 318{
318 unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); 319 unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
@@ -356,8 +357,8 @@ static ssize_t vme_user_read(struct file *file, char *buf, size_t count,
356 return retval; 357 return retval;
357} 358}
358 359
359static ssize_t vme_user_write(struct file *file, const char *buf, size_t count, 360static ssize_t vme_user_write(struct file *file, const char __user *buf,
360 loff_t *ppos) 361 size_t count, loff_t *ppos)
361{ 362{
362 unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); 363 unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
363 ssize_t retval; 364 ssize_t retval;
@@ -455,6 +456,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
455 unsigned int minor = MINOR(inode->i_rdev); 456 unsigned int minor = MINOR(inode->i_rdev);
456 int retval; 457 int retval;
457 dma_addr_t pci_addr; 458 dma_addr_t pci_addr;
459 void __user *argp = (void __user *)arg;
458 460
459 statistics.ioctls++; 461 statistics.ioctls++;
460 462
@@ -474,7 +476,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
474 &master.size, &master.aspace, 476 &master.size, &master.aspace,
475 &master.cycle, &master.dwidth); 477 &master.cycle, &master.dwidth);
476 478
477 copied = copy_to_user((char *)arg, &master, 479 copied = copy_to_user(argp, &master,
478 sizeof(struct vme_master)); 480 sizeof(struct vme_master));
479 if (copied != 0) { 481 if (copied != 0) {
480 printk(KERN_WARNING "Partial copy to " 482 printk(KERN_WARNING "Partial copy to "
@@ -487,8 +489,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
487 489
488 case VME_SET_MASTER: 490 case VME_SET_MASTER:
489 491
490 copied = copy_from_user(&master, (char *)arg, 492 copied = copy_from_user(&master, argp, sizeof(master));
491 sizeof(master));
492 if (copied != 0) { 493 if (copied != 0) {
493 printk(KERN_WARNING "Partial copy from " 494 printk(KERN_WARNING "Partial copy from "
494 "userspace\n"); 495 "userspace\n");
@@ -518,7 +519,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
518 &slave.size, &pci_addr, &slave.aspace, 519 &slave.size, &pci_addr, &slave.aspace,
519 &slave.cycle); 520 &slave.cycle);
520 521
521 copied = copy_to_user((char *)arg, &slave, 522 copied = copy_to_user(argp, &slave,
522 sizeof(struct vme_slave)); 523 sizeof(struct vme_slave));
523 if (copied != 0) { 524 if (copied != 0) {
524 printk(KERN_WARNING "Partial copy to " 525 printk(KERN_WARNING "Partial copy to "
@@ -531,8 +532,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
531 532
532 case VME_SET_SLAVE: 533 case VME_SET_SLAVE:
533 534
534 copied = copy_from_user(&slave, (char *)arg, 535 copied = copy_from_user(&slave, argp, sizeof(slave));
535 sizeof(slave));
536 if (copied != 0) { 536 if (copied != 0) {
537 printk(KERN_WARNING "Partial copy from " 537 printk(KERN_WARNING "Partial copy from "
538 "userspace\n"); 538 "userspace\n");