Commit 2d0d1430 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: drivers/char/i8 annotation

parent 9e220970
...@@ -79,7 +79,7 @@ MODULE_PARM_DESC(force, "Force loading without checking for supported models"); ...@@ -79,7 +79,7 @@ MODULE_PARM_DESC(force, "Force loading without checking for supported models");
MODULE_PARM_DESC(restricted, "Allow fan control if SYS_ADMIN capability set"); MODULE_PARM_DESC(restricted, "Allow fan control if SYS_ADMIN capability set");
MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k");
static ssize_t i8k_read(struct file *, char *, size_t, loff_t *); static ssize_t i8k_read(struct file *, char __user *, size_t, loff_t *);
static int i8k_ioctl(struct inode *, struct file *, unsigned int, static int i8k_ioctl(struct inode *, struct file *, unsigned int,
unsigned long); unsigned long);
...@@ -330,10 +330,10 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, ...@@ -330,10 +330,10 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
int val; int val;
int speed; int speed;
unsigned char buff[16]; unsigned char buff[16];
int __user *argp = (int __user *)arg;
if (!arg) { if (!argp)
return -EINVAL; return -EINVAL;
}
switch (cmd) { switch (cmd) {
case I8K_BIOS_VERSION: case I8K_BIOS_VERSION:
...@@ -358,14 +358,14 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, ...@@ -358,14 +358,14 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
break; break;
case I8K_GET_SPEED: case I8K_GET_SPEED:
if (copy_from_user(&val, (int *)arg, sizeof(int))) { if (copy_from_user(&val, argp, sizeof(int))) {
return -EFAULT; return -EFAULT;
} }
val = i8k_get_fan_speed(val); val = i8k_get_fan_speed(val);
break; break;
case I8K_GET_FAN: case I8K_GET_FAN:
if (copy_from_user(&val, (int *)arg, sizeof(int))) { if (copy_from_user(&val, argp, sizeof(int))) {
return -EFAULT; return -EFAULT;
} }
val = i8k_get_fan_status(val); val = i8k_get_fan_status(val);
...@@ -375,10 +375,10 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, ...@@ -375,10 +375,10 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
if (restricted && !capable(CAP_SYS_ADMIN)) { if (restricted && !capable(CAP_SYS_ADMIN)) {
return -EPERM; return -EPERM;
} }
if (copy_from_user(&val, (int *)arg, sizeof(int))) { if (copy_from_user(&val, argp, sizeof(int))) {
return -EFAULT; return -EFAULT;
} }
if (copy_from_user(&speed, (int *)arg+1, sizeof(int))) { if (copy_from_user(&speed, argp+1, sizeof(int))) {
return -EFAULT; return -EFAULT;
} }
val = i8k_set_fan(val, speed); val = i8k_set_fan(val, speed);
...@@ -394,17 +394,17 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, ...@@ -394,17 +394,17 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
switch (cmd) { switch (cmd) {
case I8K_BIOS_VERSION: case I8K_BIOS_VERSION:
if (copy_to_user((int *)arg, &val, 4)) { if (copy_to_user(argp, &val, 4)) {
return -EFAULT; return -EFAULT;
} }
break; break;
case I8K_MACHINE_ID: case I8K_MACHINE_ID:
if (copy_to_user((int *)arg, buff, 16)) { if (copy_to_user(argp, buff, 16)) {
return -EFAULT; return -EFAULT;
} }
break; break;
default: default:
if (copy_to_user((int *)arg, &val, sizeof(int))) { if (copy_to_user(argp, &val, sizeof(int))) {
return -EFAULT; return -EFAULT;
} }
break; break;
...@@ -462,7 +462,7 @@ static int i8k_get_info(char *buffer, char **start, off_t fpos, int length) ...@@ -462,7 +462,7 @@ static int i8k_get_info(char *buffer, char **start, off_t fpos, int length)
return n; return n;
} }
static ssize_t i8k_read(struct file *f, char *buffer, size_t len, loff_t *fpos) static ssize_t i8k_read(struct file *f, char __user *buffer, size_t len, loff_t *fpos)
{ {
int n; int n;
char info[128]; char info[128];
......
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