Commit 138b97b6 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: sonypi annotiation

parent 03ac97d8
...@@ -461,8 +461,9 @@ static int sonypi_misc_open(struct inode * inode, struct file * file) { ...@@ -461,8 +461,9 @@ static int sonypi_misc_open(struct inode * inode, struct file * file) {
return 0; return 0;
} }
static ssize_t sonypi_misc_read(struct file * file, char * buf, static ssize_t sonypi_misc_read(struct file * file, char __user * buf,
size_t count, loff_t *pos) { size_t count, loff_t *pos)
{
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
ssize_t i = count; ssize_t i = count;
unsigned char c; unsigned char c;
...@@ -504,6 +505,7 @@ static unsigned int sonypi_misc_poll(struct file *file, poll_table * wait) { ...@@ -504,6 +505,7 @@ static unsigned int sonypi_misc_poll(struct file *file, poll_table * wait) {
static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
unsigned int cmd, unsigned long arg) { unsigned int cmd, unsigned long arg) {
int ret = 0; int ret = 0;
void __user *argp = (void __user *)arg;
u8 val8; u8 val8;
u16 val16; u16 val16;
...@@ -514,11 +516,11 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ...@@ -514,11 +516,11 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
ret = -EIO; ret = -EIO;
break; break;
} }
if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) if (copy_to_user(argp, &val8, sizeof(val8)))
ret = -EFAULT; ret = -EFAULT;
break; break;
case SONYPI_IOCSBRT: case SONYPI_IOCSBRT:
if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) { if (copy_from_user(&val8, argp, sizeof(val8))) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
...@@ -530,7 +532,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ...@@ -530,7 +532,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
ret = -EIO; ret = -EIO;
break; break;
} }
if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) if (copy_to_user(argp, &val16, sizeof(val16)))
ret = -EFAULT; ret = -EFAULT;
break; break;
case SONYPI_IOCGBAT1REM: case SONYPI_IOCGBAT1REM:
...@@ -538,7 +540,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ...@@ -538,7 +540,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
ret = -EIO; ret = -EIO;
break; break;
} }
if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) if (copy_to_user(argp, &val16, sizeof(val16)))
ret = -EFAULT; ret = -EFAULT;
break; break;
case SONYPI_IOCGBAT2CAP: case SONYPI_IOCGBAT2CAP:
...@@ -546,7 +548,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ...@@ -546,7 +548,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
ret = -EIO; ret = -EIO;
break; break;
} }
if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) if (copy_to_user(argp, &val16, sizeof(val16)))
ret = -EFAULT; ret = -EFAULT;
break; break;
case SONYPI_IOCGBAT2REM: case SONYPI_IOCGBAT2REM:
...@@ -554,7 +556,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ...@@ -554,7 +556,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
ret = -EIO; ret = -EIO;
break; break;
} }
if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) if (copy_to_user(argp, &val16, sizeof(val16)))
ret = -EFAULT; ret = -EFAULT;
break; break;
case SONYPI_IOCGBATFLAGS: case SONYPI_IOCGBATFLAGS:
...@@ -563,16 +565,16 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ...@@ -563,16 +565,16 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
break; break;
} }
val8 &= 0x07; val8 &= 0x07;
if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) if (copy_to_user(argp, &val8, sizeof(val8)))
ret = -EFAULT; ret = -EFAULT;
break; break;
case SONYPI_IOCGBLUE: case SONYPI_IOCGBLUE:
val8 = sonypi_device.bluetooth_power; val8 = sonypi_device.bluetooth_power;
if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) if (copy_to_user(argp, &val8, sizeof(val8)))
ret = -EFAULT; ret = -EFAULT;
break; break;
case SONYPI_IOCSBLUE: case SONYPI_IOCSBLUE:
if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) { if (copy_from_user(&val8, argp, sizeof(val8))) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
......
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