From 9e220970c9d55a9c7749cc08310cb9969b1ac450 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Thu, 3 Jun 2004 17:23:45 -0700 Subject: [PATCH] [PATCH] sparse: lp annotation --- drivers/char/lp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/char/lp.c b/drivers/char/lp.c index c1437fb248ece..6110dbf4052c1 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -291,7 +291,7 @@ static int lp_wait_ready(int minor, int nonblock) return error; } -static ssize_t lp_write(struct file * file, const char * buf, +static ssize_t lp_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { unsigned int minor = iminor(file->f_dentry->d_inode); @@ -407,7 +407,7 @@ static ssize_t lp_write(struct file * file, const char * buf, #ifdef CONFIG_PARPORT_1284 /* Status readback conforming to ieee1284 */ -static ssize_t lp_read(struct file * file, char * buf, +static ssize_t lp_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { unsigned int minor=iminor(file->f_dentry->d_inode); @@ -560,6 +560,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, unsigned int minor = iminor(inode); int status; int retval = 0; + void __user *argp = (void __user *)arg; #ifdef LP_DEBUG printk(KERN_DEBUG "lp%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg); @@ -603,7 +604,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, return -EINVAL; break; case LPGETIRQ: - if (copy_to_user((int *) arg, &LP_IRQ(minor), + if (copy_to_user(argp, &LP_IRQ(minor), sizeof(int))) return -EFAULT; break; @@ -612,7 +613,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, status = r_str(minor); lp_release_parport (&lp_table[minor]); - if (copy_to_user((int *) arg, &status, sizeof(int))) + if (copy_to_user(argp, &status, sizeof(int))) return -EFAULT; break; case LPRESET: @@ -620,7 +621,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, break; #ifdef LP_STATS case LPGETSTATS: - if (copy_to_user((int *) arg, &LP_STAT(minor), + if (copy_to_user(argp, &LP_STAT(minor), sizeof(struct lp_stats))) return -EFAULT; if (capable(CAP_SYS_ADMIN)) @@ -630,13 +631,12 @@ static int lp_ioctl(struct inode *inode, struct file *file, #endif case LPGETFLAGS: status = LP_F(minor); - if (copy_to_user((int *) arg, &status, sizeof(int))) + if (copy_to_user(argp, &status, sizeof(int))) return -EFAULT; break; case LPSETTIMEOUT: - if (copy_from_user (&par_timeout, - (struct timeval *) arg, + if (copy_from_user (&par_timeout, argp, sizeof (struct timeval))) { return -EFAULT; } -- 2.53.0