Commit cb960669 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: drivers/char/watchdog annotation

Trivial annotations in drivers/char/watchdog/*
parent bdda2a3e
...@@ -111,7 +111,7 @@ static void acq_stop(void) ...@@ -111,7 +111,7 @@ static void acq_stop(void)
* /dev/watchdog handling. * /dev/watchdog handling.
*/ */
static ssize_t acq_write(struct file *file, const char *buf, size_t count, loff_t *ppos) static ssize_t acq_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -146,6 +146,8 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -146,6 +146,8 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = static struct watchdog_info ident =
{ {
.options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
...@@ -156,22 +158,22 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -156,22 +158,22 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch(cmd) switch(cmd)
{ {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)) ? -EFAULT : 0; return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
acq_keepalive(); acq_keepalive();
return 0; return 0;
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_HEARTBEAT, (int *)arg); return put_user(WATCHDOG_HEARTBEAT, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
if (get_user(options, (int *)arg)) if (get_user(options, p))
return -EFAULT; return -EFAULT;
if (options & WDIOS_DISABLECARD) if (options & WDIOS_DISABLECARD)
......
...@@ -100,7 +100,7 @@ advwdt_disable(void) ...@@ -100,7 +100,7 @@ advwdt_disable(void)
} }
static ssize_t static ssize_t
advwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -130,6 +130,8 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -130,6 +130,8 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
int new_timeout; int new_timeout;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
...@@ -138,20 +140,20 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -138,20 +140,20 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT; return -EFAULT;
break; break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
advwdt_ping(); advwdt_ping();
break; break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *)arg)) if (get_user(new_timeout, p))
return -EFAULT; return -EFAULT;
if ((new_timeout < 1) || (new_timeout > 63)) if ((new_timeout < 1) || (new_timeout > 63))
return -EINVAL; return -EINVAL;
...@@ -160,13 +162,13 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -160,13 +162,13 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg); return put_user(timeout, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
if (get_user(options, (int *)arg)) if (get_user(options, p))
return -EFAULT; return -EFAULT;
if (options & WDIOS_DISABLECARD) { if (options & WDIOS_DISABLECARD) {
......
...@@ -138,7 +138,7 @@ static int ali_settimer(int t) ...@@ -138,7 +138,7 @@ static int ali_settimer(int t)
* the next close to turn off the watchdog. * the next close to turn off the watchdog.
*/ */
static ssize_t ali_write(struct file *file, const char *data, static ssize_t ali_write(struct file *file, const char __user *data,
size_t len, loff_t * ppos) size_t len, loff_t * ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
...@@ -184,6 +184,8 @@ static ssize_t ali_write(struct file *file, const char *data, ...@@ -184,6 +184,8 @@ static ssize_t ali_write(struct file *file, const char *data,
static int ali_ioctl(struct inode *inode, struct file *file, static int ali_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | .options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
...@@ -194,12 +196,12 @@ static int ali_ioctl(struct inode *inode, struct file *file, ...@@ -194,12 +196,12 @@ static int ali_ioctl(struct inode *inode, struct file *file,
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *) arg, &ident, return copy_to_user(argp, &ident,
sizeof (ident)) ? -EFAULT : 0; sizeof (ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *) arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
ali_keepalive(); ali_keepalive();
...@@ -209,7 +211,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, ...@@ -209,7 +211,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
if (get_user (new_options, (int *) arg)) if (get_user (new_options, p))
return -EFAULT; return -EFAULT;
if (new_options & WDIOS_DISABLECARD) { if (new_options & WDIOS_DISABLECARD) {
...@@ -229,7 +231,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, ...@@ -229,7 +231,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
{ {
int new_timeout; int new_timeout;
if (get_user(new_timeout, (int *) arg)) if (get_user(new_timeout, p))
return -EFAULT; return -EFAULT;
if (ali_settimer(new_timeout)) if (ali_settimer(new_timeout))
...@@ -240,7 +242,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, ...@@ -240,7 +242,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg); return put_user(timeout, p);
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
......
...@@ -148,7 +148,7 @@ static void wdt_keepalive(void) ...@@ -148,7 +148,7 @@ static void wdt_keepalive(void)
* /dev/watchdog handling * /dev/watchdog handling
*/ */
static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
{ {
/* We can't seek */ /* We can't seek */
if(ppos != &file->f_pos) if(ppos != &file->f_pos)
...@@ -203,6 +203,8 @@ static int fop_close(struct inode * inode, struct file * file) ...@@ -203,6 +203,8 @@ static int fop_close(struct inode * inode, struct file * file)
static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = static struct watchdog_info ident =
{ {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
...@@ -213,10 +215,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -213,10 +215,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
switch(cmd) switch(cmd)
{ {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdt_keepalive(); wdt_keepalive();
return 0; return 0;
...@@ -224,7 +226,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -224,7 +226,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
if(get_user(new_options, (int *)arg)) if(get_user(new_options, p))
return -EFAULT; return -EFAULT;
if(new_options & WDIOS_DISABLECARD) { if(new_options & WDIOS_DISABLECARD) {
...@@ -243,7 +245,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -243,7 +245,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
{ {
int new_timeout; int new_timeout;
if(get_user(new_timeout, (int *)arg)) if(get_user(new_timeout, p))
return -EFAULT; return -EFAULT;
if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */ if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */
...@@ -254,7 +256,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -254,7 +256,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
/* Fall through */ /* Fall through */
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg); return put_user(timeout, p);
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
......
...@@ -145,6 +145,7 @@ static int cpu5wdt_release(struct inode *inode, struct file *file) ...@@ -145,6 +145,7 @@ static int cpu5wdt_release(struct inode *inode, struct file *file)
static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
unsigned int value; unsigned int value;
static struct watchdog_info ident = static struct watchdog_info ident =
{ {
...@@ -159,15 +160,15 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm ...@@ -159,15 +160,15 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
value = inb(port + CPU5WDT_STATUS_REG); value = inb(port + CPU5WDT_STATUS_REG);
value = (value >> 2) & 1; value = (value >> 2) & 1;
if ( copy_to_user((int *)arg, (int *)&value, sizeof(int)) ) if ( copy_to_user(argp, &value, sizeof(int)) )
return -EFAULT; return -EFAULT;
break; break;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if ( copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)) ) if ( copy_to_user(argp, &ident, sizeof(ident)) )
return -EFAULT; return -EFAULT;
break; break;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if ( copy_from_user(&value, (int *)arg, sizeof(int)) ) if ( copy_from_user(&value, argp, sizeof(int)) )
return -EFAULT; return -EFAULT;
switch(value) { switch(value) {
case WDIOS_ENABLECARD: case WDIOS_ENABLECARD:
...@@ -185,7 +186,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm ...@@ -185,7 +186,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
return 0; return 0;
} }
static ssize_t cpu5wdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) static ssize_t cpu5wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
if ( !count ) if ( !count )
return -EIO; return -EIO;
......
...@@ -196,8 +196,8 @@ static void eurwdt_ping(void) ...@@ -196,8 +196,8 @@ static void eurwdt_ping(void)
* write of data will do, as we we don't define content meaning. * write of data will do, as we we don't define content meaning.
*/ */
static ssize_t eurwdt_write(struct file *file, const char *buf, size_t count, static ssize_t eurwdt_write(struct file *file, const char __user *buf,
loff_t *ppos) size_t count, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -237,6 +237,8 @@ loff_t *ppos) ...@@ -237,6 +237,8 @@ loff_t *ppos)
static int eurwdt_ioctl(struct inode *inode, struct file *file, static int eurwdt_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
...@@ -251,19 +253,18 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file, ...@@ -251,19 +253,18 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *) arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
eurwdt_ping(); eurwdt_ping();
return 0; return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (copy_from_user(&time, (int *) arg, sizeof(int))) if (copy_from_user(&time, p, sizeof(int)))
return -EFAULT; return -EFAULT;
/* Sanity check */ /* Sanity check */
...@@ -275,10 +276,10 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file, ...@@ -275,10 +276,10 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(eurwdt_timeout, (int *)arg); return put_user(eurwdt_timeout, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user(options, (int *)arg)) if (get_user(options, p))
return -EFAULT; return -EFAULT;
if (options & WDIOS_DISABLECARD) { if (options & WDIOS_DISABLECARD) {
eurwdt_disable_timer(); eurwdt_disable_timer();
......
...@@ -212,7 +212,7 @@ static int i8xx_tco_release (struct inode *inode, struct file *file) ...@@ -212,7 +212,7 @@ static int i8xx_tco_release (struct inode *inode, struct file *file)
return 0; return 0;
} }
static ssize_t i8xx_tco_write (struct file *file, const char *data, static ssize_t i8xx_tco_write (struct file *file, const char __user *data,
size_t len, loff_t * ppos) size_t len, loff_t * ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
...@@ -249,6 +249,8 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, ...@@ -249,6 +249,8 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
int new_heartbeat; int new_heartbeat;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
...@@ -259,12 +261,12 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, ...@@ -259,12 +261,12 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *) arg, &ident, return copy_to_user(argp, &ident,
sizeof (ident)) ? -EFAULT : 0; sizeof (ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user (0, (int *) arg); return put_user (0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
tco_timer_keepalive (); tco_timer_keepalive ();
...@@ -272,7 +274,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, ...@@ -272,7 +274,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
if (get_user (new_options, (int *) arg)) if (get_user (new_options, p))
return -EFAULT; return -EFAULT;
if (new_options & WDIOS_DISABLECARD) { if (new_options & WDIOS_DISABLECARD) {
...@@ -291,7 +293,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, ...@@ -291,7 +293,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
{ {
if (get_user(new_heartbeat, (int *) arg)) if (get_user(new_heartbeat, p))
return -EFAULT; return -EFAULT;
if (tco_timer_set_heartbeat(new_heartbeat)) if (tco_timer_set_heartbeat(new_heartbeat))
...@@ -302,7 +304,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, ...@@ -302,7 +304,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg); return put_user(heartbeat, p);
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
......
...@@ -139,7 +139,7 @@ ibwdt_ping(void) ...@@ -139,7 +139,7 @@ ibwdt_ping(void)
} }
static ssize_t static ssize_t
ibwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -170,6 +170,8 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -170,6 +170,8 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
int i, new_margin; int i, new_margin;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
...@@ -179,19 +181,19 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -179,19 +181,19 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT; return -EFAULT;
break; break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
return put_user(0, (int *) arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
ibwdt_ping(); ibwdt_ping();
break; break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_margin, (int *)arg)) if (get_user(new_margin, p))
return -EFAULT; return -EFAULT;
if ((new_margin < 0) || (new_margin > 30)) if ((new_margin < 0) || (new_margin > 30))
return -EINVAL; return -EINVAL;
...@@ -203,7 +205,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -203,7 +205,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(wd_times[wd_margin], (int *)arg); return put_user(wd_times[wd_margin], p);
break; break;
default: default:
......
...@@ -302,7 +302,7 @@ static void zf_ping(unsigned long data) ...@@ -302,7 +302,7 @@ static void zf_ping(unsigned long data)
} }
} }
static ssize_t zf_write(struct file *file, const char *buf, size_t count, static ssize_t zf_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
...@@ -352,15 +352,16 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count, ...@@ -352,15 +352,16 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count,
static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
switch(cmd){ switch(cmd){
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, if (copy_to_user(argp, &zf_info, sizeof(zf_info)))
&zf_info, sizeof(zf_info)))
return -EFAULT; return -EFAULT;
break; break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
return put_user(0, (int *) arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
zf_ping(0); zf_ping(0);
......
...@@ -134,7 +134,7 @@ static int mixcomwd_release(struct inode *inode, struct file *file) ...@@ -134,7 +134,7 @@ static int mixcomwd_release(struct inode *inode, struct file *file)
} }
static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, loff_t *ppos) static ssize_t mixcomwd_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
{ {
if (ppos != &file->f_pos) { if (ppos != &file->f_pos) {
return -ESPIPE; return -ESPIPE;
...@@ -164,6 +164,8 @@ static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, l ...@@ -164,6 +164,8 @@ static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, l
static int mixcomwd_ioctl(struct inode *inode, struct file *file, static int mixcomwd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
int status; int status;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
...@@ -178,13 +180,12 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file, ...@@ -178,13 +180,12 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
if (!nowayout) { if (!nowayout) {
status|=mixcomwd_timer_alive; status|=mixcomwd_timer_alive;
} }
if (copy_to_user((int *)arg, &status, sizeof(int))) { if (copy_to_user(p, &status, sizeof(int))) {
return -EFAULT; return -EFAULT;
} }
break; break;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, if (copy_to_user(argp, &ident, sizeof(ident))) {
sizeof(ident))) {
return -EFAULT; return -EFAULT;
} }
break; break;
......
...@@ -258,7 +258,7 @@ static int pcipcwd_get_temperature(int *temperature) ...@@ -258,7 +258,7 @@ static int pcipcwd_get_temperature(int *temperature)
* /dev/watchdog handling * /dev/watchdog handling
*/ */
static ssize_t pcipcwd_write(struct file *file, const char *data, static ssize_t pcipcwd_write(struct file *file, const char __user *data,
size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
...@@ -293,6 +293,8 @@ static ssize_t pcipcwd_write(struct file *file, const char *data, ...@@ -293,6 +293,8 @@ static ssize_t pcipcwd_write(struct file *file, const char *data,
static int pcipcwd_ioctl(struct inode *inode, struct file *file, static int pcipcwd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_OVERHEAT | .options = WDIOF_OVERHEAT |
WDIOF_CARDRESET | WDIOF_CARDRESET |
...@@ -305,7 +307,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, ...@@ -305,7 +307,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *) arg, &ident, return copy_to_user(argp, &ident,
sizeof (ident)) ? -EFAULT : 0; sizeof (ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
...@@ -314,11 +316,11 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, ...@@ -314,11 +316,11 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
pcipcwd_get_status(&status); pcipcwd_get_status(&status);
return put_user(status, (int *) arg); return put_user(status, p);
} }
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(pcipcwd_private.boot_status, (int *) arg); return put_user(pcipcwd_private.boot_status, p);
case WDIOC_GETTEMP: case WDIOC_GETTEMP:
{ {
...@@ -327,7 +329,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, ...@@ -327,7 +329,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
if (pcipcwd_get_temperature(&temperature)) if (pcipcwd_get_temperature(&temperature))
return -EFAULT; return -EFAULT;
return put_user(temperature, (int *) arg); return put_user(temperature, p);
} }
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
...@@ -338,7 +340,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, ...@@ -338,7 +340,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
if (get_user (new_options, (int *) arg)) if (get_user (new_options, p))
return -EFAULT; return -EFAULT;
if (new_options & WDIOS_DISABLECARD) { if (new_options & WDIOS_DISABLECARD) {
...@@ -363,7 +365,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, ...@@ -363,7 +365,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
{ {
int new_heartbeat; int new_heartbeat;
if (get_user(new_heartbeat, (int *) arg)) if (get_user(new_heartbeat, p))
return -EFAULT; return -EFAULT;
if (pcipcwd_set_heartbeat(new_heartbeat)) if (pcipcwd_set_heartbeat(new_heartbeat))
...@@ -374,7 +376,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, ...@@ -374,7 +376,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg); return put_user(heartbeat, p);
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
...@@ -413,7 +415,7 @@ static int pcipcwd_release(struct inode *inode, struct file *file) ...@@ -413,7 +415,7 @@ static int pcipcwd_release(struct inode *inode, struct file *file)
* /dev/temperature handling * /dev/temperature handling
*/ */
static ssize_t pcipcwd_temp_read(struct file *file, char *data, static ssize_t pcipcwd_temp_read(struct file *file, char __user *data,
size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
int temperature; int temperature;
......
...@@ -326,7 +326,7 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp ...@@ -326,7 +326,7 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp
* /dev/watchdog handling * /dev/watchdog handling
*/ */
static ssize_t usb_pcwd_write(struct file *file, const char *data, static ssize_t usb_pcwd_write(struct file *file, const char __user *data,
size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
...@@ -361,6 +361,8 @@ static ssize_t usb_pcwd_write(struct file *file, const char *data, ...@@ -361,6 +361,8 @@ static ssize_t usb_pcwd_write(struct file *file, const char *data,
static int usb_pcwd_ioctl(struct inode *inode, struct file *file, static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | .options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
...@@ -371,12 +373,12 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, ...@@ -371,12 +373,12 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *) arg, &ident, return copy_to_user(argp, &ident,
sizeof (ident)) ? -EFAULT : 0; sizeof (ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *) arg); return put_user(0, p);
case WDIOC_GETTEMP: case WDIOC_GETTEMP:
{ {
...@@ -385,7 +387,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, ...@@ -385,7 +387,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature)) if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
return -EFAULT; return -EFAULT;
return put_user(temperature, (int *) arg); return put_user(temperature, p);
} }
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
...@@ -396,7 +398,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, ...@@ -396,7 +398,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
if (get_user (new_options, (int *) arg)) if (get_user (new_options, p))
return -EFAULT; return -EFAULT;
if (new_options & WDIOS_DISABLECARD) { if (new_options & WDIOS_DISABLECARD) {
...@@ -416,7 +418,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, ...@@ -416,7 +418,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
{ {
int new_heartbeat; int new_heartbeat;
if (get_user(new_heartbeat, (int *) arg)) if (get_user(new_heartbeat, p))
return -EFAULT; return -EFAULT;
if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat)) if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
...@@ -427,7 +429,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, ...@@ -427,7 +429,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg); return put_user(heartbeat, p);
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
...@@ -466,7 +468,7 @@ static int usb_pcwd_release(struct inode *inode, struct file *file) ...@@ -466,7 +468,7 @@ static int usb_pcwd_release(struct inode *inode, struct file *file)
* /dev/temperature handling * /dev/temperature handling
*/ */
static ssize_t usb_pcwd_temperature_read(struct file *file, char *data, static ssize_t usb_pcwd_temperature_read(struct file *file, char __user *data,
size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
int temperature; int temperature;
...@@ -478,7 +480,7 @@ static ssize_t usb_pcwd_temperature_read(struct file *file, char *data, ...@@ -478,7 +480,7 @@ static ssize_t usb_pcwd_temperature_read(struct file *file, char *data,
if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature)) if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
return -EFAULT; return -EFAULT;
if (copy_to_user (data, &temperature, 1)) if (copy_to_user(data, &temperature, 1))
return -EFAULT; return -EFAULT;
return 1; return 1;
......
...@@ -166,7 +166,7 @@ static void wdt_keepalive(void) ...@@ -166,7 +166,7 @@ static void wdt_keepalive(void)
* /dev/watchdog handling * /dev/watchdog handling
*/ */
static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
{ {
/* We can't seek */ /* We can't seek */
if(ppos != &file->f_pos) if(ppos != &file->f_pos)
...@@ -230,6 +230,8 @@ static int fop_close(struct inode * inode, struct file * file) ...@@ -230,6 +230,8 @@ static int fop_close(struct inode * inode, struct file * file)
static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident= static struct watchdog_info ident=
{ {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
...@@ -242,10 +244,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -242,10 +244,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdt_keepalive(); wdt_keepalive();
return 0; return 0;
...@@ -253,7 +255,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -253,7 +255,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
if(get_user(new_options, (int *)arg)) if(get_user(new_options, p))
return -EFAULT; return -EFAULT;
if(new_options & WDIOS_DISABLECARD) { if(new_options & WDIOS_DISABLECARD) {
...@@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{ {
int new_timeout; int new_timeout;
if(get_user(new_timeout, (int *)arg)) if(get_user(new_timeout, p))
return -EFAULT; return -EFAULT;
if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */ if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */
...@@ -283,7 +285,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -283,7 +285,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall through */ /* Fall through */
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg); return put_user(timeout, p);
} }
} }
......
...@@ -174,6 +174,8 @@ static int sc1200wdt_open(struct inode *inode, struct file *file) ...@@ -174,6 +174,8 @@ static int sc1200wdt_open(struct inode *inode, struct file *file)
static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{ {
int new_timeout; int new_timeout;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 0, .firmware_version = 0,
...@@ -185,22 +187,22 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int ...@@ -185,22 +187,22 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
return -ENOIOCTLCMD; /* Keep Pavel Machek amused ;) */ return -ENOIOCTLCMD; /* Keep Pavel Machek amused ;) */
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof ident)) if (copy_to_user(argp, &ident, sizeof ident))
return -EFAULT; return -EFAULT;
return 0; return 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
return put_user(sc1200wdt_status(), (int *)arg); return put_user(sc1200wdt_status(), p);
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
sc1200wdt_write_data(WDTO, timeout); sc1200wdt_write_data(WDTO, timeout);
return 0; return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *)arg)) if (get_user(new_timeout, p))
return -EFAULT; return -EFAULT;
/* the API states this is given in secs */ /* the API states this is given in secs */
...@@ -213,13 +215,13 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int ...@@ -213,13 +215,13 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
/* fall through and return the new timeout */ /* fall through and return the new timeout */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout * 60, (int *)arg); return put_user(timeout * 60, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
if (get_user(options, (int *)arg)) if (get_user(options, p))
return -EFAULT; return -EFAULT;
if (options & WDIOS_DISABLECARD) { if (options & WDIOS_DISABLECARD) {
...@@ -254,7 +256,7 @@ static int sc1200wdt_release(struct inode *inode, struct file *file) ...@@ -254,7 +256,7 @@ static int sc1200wdt_release(struct inode *inode, struct file *file)
} }
static ssize_t sc1200wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos) static ssize_t sc1200wdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
{ {
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
return -ESPIPE; return -ESPIPE;
......
...@@ -225,7 +225,7 @@ static int wdt_set_heartbeat(int t) ...@@ -225,7 +225,7 @@ static int wdt_set_heartbeat(int t)
* /dev/watchdog handling * /dev/watchdog handling
*/ */
static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
{ {
/* We can't seek */ /* We can't seek */
if(ppos != &file->f_pos) if(ppos != &file->f_pos)
...@@ -285,6 +285,8 @@ static int fop_close(struct inode * inode, struct file * file) ...@@ -285,6 +285,8 @@ static int fop_close(struct inode * inode, struct file * file)
static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
...@@ -296,10 +298,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -296,10 +298,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdt_keepalive(); wdt_keepalive();
return 0; return 0;
...@@ -307,7 +309,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -307,7 +309,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
if(get_user(new_options, (int *)arg)) if(get_user(new_options, p))
return -EFAULT; return -EFAULT;
if(new_options & WDIOS_DISABLECARD) { if(new_options & WDIOS_DISABLECARD) {
...@@ -326,7 +328,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -326,7 +328,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{ {
int new_timeout; int new_timeout;
if(get_user(new_timeout, (int *)arg)) if(get_user(new_timeout, p))
return -EFAULT; return -EFAULT;
if(wdt_set_heartbeat(new_timeout)) if(wdt_set_heartbeat(new_timeout))
...@@ -336,7 +338,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -336,7 +338,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall through */ /* Fall through */
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg); return put_user(timeout, p);
} }
} }
......
...@@ -132,7 +132,7 @@ static struct notifier_block scx200_wdt_notifier = ...@@ -132,7 +132,7 @@ static struct notifier_block scx200_wdt_notifier =
.notifier_call = scx200_wdt_notify_sys, .notifier_call = scx200_wdt_notify_sys,
}; };
static ssize_t scx200_wdt_write(struct file *file, const char *data, static ssize_t scx200_wdt_write(struct file *file, const char __user *data,
size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -163,6 +163,8 @@ static ssize_t scx200_wdt_write(struct file *file, const char *data, ...@@ -163,6 +163,8 @@ static ssize_t scx200_wdt_write(struct file *file, const char *data,
static int scx200_wdt_ioctl(struct inode *inode, struct file *file, static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.identity = "NatSemi SCx200 Watchdog", .identity = "NatSemi SCx200 Watchdog",
.firmware_version = 1, .firmware_version = 1,
...@@ -174,20 +176,19 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file, ...@@ -174,20 +176,19 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if(copy_to_user((struct watchdog_info *)arg, &ident, if(copy_to_user(argp, &ident, sizeof(ident)))
sizeof(ident)))
return -EFAULT; return -EFAULT;
return 0; return 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
if (put_user(0, (int *)arg)) if (put_user(0, p))
return -EFAULT; return -EFAULT;
return 0; return 0;
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
scx200_wdt_ping(); scx200_wdt_ping();
return 0; return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_margin, (int *)arg)) if (get_user(new_margin, p))
return -EFAULT; return -EFAULT;
if (new_margin < 1) if (new_margin < 1)
return -EINVAL; return -EINVAL;
...@@ -195,7 +196,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file, ...@@ -195,7 +196,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
scx200_wdt_update_margin(); scx200_wdt_update_margin();
scx200_wdt_ping(); scx200_wdt_ping();
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
if (put_user(margin, (int *)arg)) if (put_user(margin, p))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
......
...@@ -161,7 +161,7 @@ static int softdog_release(struct inode *inode, struct file *file) ...@@ -161,7 +161,7 @@ static int softdog_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static ssize_t softdog_write(struct file *file, const char *data, size_t len, loff_t *ppos) static ssize_t softdog_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -194,6 +194,8 @@ static ssize_t softdog_write(struct file *file, const char *data, size_t len, lo ...@@ -194,6 +194,8 @@ static ssize_t softdog_write(struct file *file, const char *data, size_t len, lo
static int softdog_ioctl(struct inode *inode, struct file *file, static int softdog_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
int new_margin; int new_margin;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
...@@ -206,23 +208,23 @@ static int softdog_ioctl(struct inode *inode, struct file *file, ...@@ -206,23 +208,23 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, return copy_to_user(argp, &ident,
sizeof(ident)) ? -EFAULT : 0; sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0,(int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
softdog_keepalive(); softdog_keepalive();
return 0; return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_margin, (int *)arg)) if (get_user(new_margin, p))
return -EFAULT; return -EFAULT;
if (softdog_set_heartbeat(new_margin)) if (softdog_set_heartbeat(new_margin))
return -EINVAL; return -EINVAL;
softdog_keepalive(); softdog_keepalive();
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(soft_margin, (int *)arg); return put_user(soft_margin, p);
} }
} }
......
...@@ -142,7 +142,7 @@ wdt_set_heartbeat(int t) ...@@ -142,7 +142,7 @@ wdt_set_heartbeat(int t)
} }
static ssize_t static ssize_t
wdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -171,6 +171,8 @@ static int ...@@ -171,6 +171,8 @@ static int
wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
int new_timeout; int new_timeout;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
...@@ -180,20 +182,20 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -180,20 +182,20 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT; return -EFAULT;
break; break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdt_ping(); wdt_ping();
break; break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *)arg)) if (get_user(new_timeout, p))
return -EFAULT; return -EFAULT;
if (wdt_set_heartbeat(new_timeout)) if (wdt_set_heartbeat(new_timeout))
return -EINVAL; return -EINVAL;
...@@ -201,13 +203,13 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -201,13 +203,13 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg); return put_user(timeout, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
if (get_user(options, (int *)arg)) if (get_user(options, p))
return -EFAULT; return -EFAULT;
if (options & WDIOS_DISABLECARD) { if (options & WDIOS_DISABLECARD) {
......
...@@ -188,7 +188,7 @@ static void wdt_keepalive(void) ...@@ -188,7 +188,7 @@ static void wdt_keepalive(void)
* /dev/watchdog handling * /dev/watchdog handling
*/ */
static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
{ {
/* We can't seek */ /* We can't seek */
if(ppos != &file->f_pos) if(ppos != &file->f_pos)
...@@ -249,6 +249,8 @@ static int fop_close(struct inode * inode, struct file * file) ...@@ -249,6 +249,8 @@ static int fop_close(struct inode * inode, struct file * file)
static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident= static struct watchdog_info ident=
{ {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
...@@ -261,10 +263,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -261,10 +263,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdt_keepalive(); wdt_keepalive();
return 0; return 0;
...@@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{ {
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
if(get_user(new_options, (int *)arg)) if(get_user(new_options, p))
return -EFAULT; return -EFAULT;
if(new_options & WDIOS_DISABLECARD) { if(new_options & WDIOS_DISABLECARD) {
...@@ -291,7 +293,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -291,7 +293,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{ {
int new_timeout; int new_timeout;
if(get_user(new_timeout, (int *)arg)) if(get_user(new_timeout, p))
return -EFAULT; return -EFAULT;
if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */ if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */
...@@ -302,7 +304,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -302,7 +304,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall through */ /* Fall through */
} }
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg); return put_user(timeout, p);
} }
} }
......
...@@ -95,7 +95,7 @@ wafwdt_stop(void) ...@@ -95,7 +95,7 @@ wafwdt_stop(void)
inb_p(wdt_stop); inb_p(wdt_stop);
} }
static ssize_t wafwdt_write(struct file *file, const char *buf, size_t count, loff_t * ppos) static ssize_t wafwdt_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -128,6 +128,8 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -128,6 +128,8 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
unsigned long arg) unsigned long arg)
{ {
int new_timeout; int new_timeout;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
...@@ -136,21 +138,20 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -136,21 +138,20 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user if (copy_to_user(argp, &ident, sizeof (ident)))
((struct watchdog_info *) arg, &ident, sizeof (ident)))
return -EFAULT; return -EFAULT;
break; break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wafwdt_ping(); wafwdt_ping();
break; break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *)arg)) if (get_user(new_timeout, p))
return -EFAULT; return -EFAULT;
if ((new_timeout < 1) || (new_timeout > 255)) if ((new_timeout < 1) || (new_timeout > 255))
return -EINVAL; return -EINVAL;
...@@ -159,13 +160,13 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -159,13 +160,13 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
wafwdt_start(); wafwdt_start();
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg); return put_user(timeout, p);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
if (get_user(options, (int *)arg)) if (get_user(options, p))
return -EFAULT; return -EFAULT;
if (options & WDIOS_DISABLECARD) { if (options & WDIOS_DISABLECARD) {
......
...@@ -286,7 +286,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -286,7 +286,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id, struct pt_regs *regs)
* write of data will do, as we we don't define content meaning. * write of data will do, as we we don't define content meaning.
*/ */
static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) static ssize_t wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -327,6 +327,8 @@ static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_ ...@@ -327,6 +327,8 @@ static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_
static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
void __user *argp = (void __user *)arg;
int __user *p = argp;
int new_heartbeat; int new_heartbeat;
int status; int status;
...@@ -351,18 +353,18 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -351,18 +353,18 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
wdt_get_status(&status); wdt_get_status(&status);
return put_user(status,(int *)arg); return put_user(status, p);
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdt_ping(); wdt_ping();
return 0; return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_heartbeat, (int *)arg)) if (get_user(new_heartbeat, p))
return -EFAULT; return -EFAULT;
if (wdt_set_heartbeat(new_heartbeat)) if (wdt_set_heartbeat(new_heartbeat))
...@@ -371,7 +373,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -371,7 +373,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
wdt_ping(); wdt_ping();
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg); return put_user(heartbeat, p);
} }
} }
...@@ -435,7 +437,7 @@ static int wdt_release(struct inode *inode, struct file *file) ...@@ -435,7 +437,7 @@ static int wdt_release(struct inode *inode, struct file *file)
* farenheit. It was designed by an imperial measurement luddite. * farenheit. It was designed by an imperial measurement luddite.
*/ */
static ssize_t wdt_temp_read(struct file *file, char *buf, size_t count, loff_t *ptr) static ssize_t wdt_temp_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
{ {
int temperature; int temperature;
......
...@@ -331,7 +331,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -331,7 +331,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id, struct pt_regs *regs)
* write of data will do, as we we don't define content meaning. * write of data will do, as we we don't define content meaning.
*/ */
static ssize_t wdtpci_write(struct file *file, const char *buf, size_t count, loff_t *ppos) static ssize_t wdtpci_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -374,6 +374,8 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -374,6 +374,8 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
{ {
int new_heartbeat; int new_heartbeat;
int status; int status;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT| .options = WDIOF_SETTIMEOUT|
...@@ -396,18 +398,18 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -396,18 +398,18 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
wdtpci_get_status(&status); wdtpci_get_status(&status);
return put_user(status,(int *)arg); return put_user(status, p);
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg); return put_user(0, p);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdtpci_ping(); wdtpci_ping();
return 0; return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_heartbeat, (int *)arg)) if (get_user(new_heartbeat, p))
return -EFAULT; return -EFAULT;
if (wdtpci_set_heartbeat(new_heartbeat)) if (wdtpci_set_heartbeat(new_heartbeat))
...@@ -416,7 +418,7 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -416,7 +418,7 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
wdtpci_ping(); wdtpci_ping();
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg); return put_user(heartbeat, p);
} }
} }
...@@ -484,7 +486,7 @@ static int wdtpci_release(struct inode *inode, struct file *file) ...@@ -484,7 +486,7 @@ static int wdtpci_release(struct inode *inode, struct file *file)
* fahrenheit. It was designed by an imperial measurement luddite. * fahrenheit. It was designed by an imperial measurement luddite.
*/ */
static ssize_t wdtpci_temp_read(struct file *file, char *buf, size_t count, loff_t *ptr) static ssize_t wdtpci_temp_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
{ {
int temperature; int temperature;
......
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