Commit 9e220970 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: lp annotation

parent 3569e846
...@@ -291,7 +291,7 @@ static int lp_wait_ready(int minor, int nonblock) ...@@ -291,7 +291,7 @@ static int lp_wait_ready(int minor, int nonblock)
return error; 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) size_t count, loff_t *ppos)
{ {
unsigned int minor = iminor(file->f_dentry->d_inode); unsigned int minor = iminor(file->f_dentry->d_inode);
...@@ -407,7 +407,7 @@ static ssize_t lp_write(struct file * file, const char * buf, ...@@ -407,7 +407,7 @@ static ssize_t lp_write(struct file * file, const char * buf,
#ifdef CONFIG_PARPORT_1284 #ifdef CONFIG_PARPORT_1284
/* Status readback conforming to ieee1284 */ /* 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) size_t count, loff_t *ppos)
{ {
unsigned int minor=iminor(file->f_dentry->d_inode); unsigned int minor=iminor(file->f_dentry->d_inode);
...@@ -560,6 +560,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, ...@@ -560,6 +560,7 @@ static int lp_ioctl(struct inode *inode, struct file *file,
unsigned int minor = iminor(inode); unsigned int minor = iminor(inode);
int status; int status;
int retval = 0; int retval = 0;
void __user *argp = (void __user *)arg;
#ifdef LP_DEBUG #ifdef LP_DEBUG
printk(KERN_DEBUG "lp%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg); 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, ...@@ -603,7 +604,7 @@ static int lp_ioctl(struct inode *inode, struct file *file,
return -EINVAL; return -EINVAL;
break; break;
case LPGETIRQ: case LPGETIRQ:
if (copy_to_user((int *) arg, &LP_IRQ(minor), if (copy_to_user(argp, &LP_IRQ(minor),
sizeof(int))) sizeof(int)))
return -EFAULT; return -EFAULT;
break; break;
...@@ -612,7 +613,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, ...@@ -612,7 +613,7 @@ static int lp_ioctl(struct inode *inode, struct file *file,
status = r_str(minor); status = r_str(minor);
lp_release_parport (&lp_table[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; return -EFAULT;
break; break;
case LPRESET: case LPRESET:
...@@ -620,7 +621,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, ...@@ -620,7 +621,7 @@ static int lp_ioctl(struct inode *inode, struct file *file,
break; break;
#ifdef LP_STATS #ifdef LP_STATS
case LPGETSTATS: case LPGETSTATS:
if (copy_to_user((int *) arg, &LP_STAT(minor), if (copy_to_user(argp, &LP_STAT(minor),
sizeof(struct lp_stats))) sizeof(struct lp_stats)))
return -EFAULT; return -EFAULT;
if (capable(CAP_SYS_ADMIN)) if (capable(CAP_SYS_ADMIN))
...@@ -630,13 +631,12 @@ static int lp_ioctl(struct inode *inode, struct file *file, ...@@ -630,13 +631,12 @@ static int lp_ioctl(struct inode *inode, struct file *file,
#endif #endif
case LPGETFLAGS: case LPGETFLAGS:
status = LP_F(minor); status = LP_F(minor);
if (copy_to_user((int *) arg, &status, sizeof(int))) if (copy_to_user(argp, &status, sizeof(int)))
return -EFAULT; return -EFAULT;
break; break;
case LPSETTIMEOUT: case LPSETTIMEOUT:
if (copy_from_user (&par_timeout, if (copy_from_user (&par_timeout, argp,
(struct timeval *) arg,
sizeof (struct timeval))) { sizeof (struct timeval))) {
return -EFAULT; return -EFAULT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment