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)
* /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 */
if (ppos != &file->f_pos)
......@@ -146,6 +146,8 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
int options, retval = -EINVAL;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident =
{
.options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
......@@ -156,22 +158,22 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch(cmd)
{
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_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
acq_keepalive();
return 0;
case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_HEARTBEAT, (int *)arg);
return put_user(WATCHDOG_HEARTBEAT, p);
case WDIOC_SETOPTIONS:
{
if (get_user(options, (int *)arg))
if (get_user(options, p))
return -EFAULT;
if (options & WDIOS_DISABLECARD)
......
......@@ -100,7 +100,7 @@ advwdt_disable(void)
}
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 */
if (ppos != &file->f_pos)
......@@ -130,6 +130,8 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
int new_timeout;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1,
......@@ -138,20 +140,20 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch (cmd) {
case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
advwdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *)arg))
if (get_user(new_timeout, p))
return -EFAULT;
if ((new_timeout < 1) || (new_timeout > 63))
return -EINVAL;
......@@ -160,13 +162,13 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg);
return put_user(timeout, p);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
if (get_user(options, (int *)arg))
if (get_user(options, p))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
......
......@@ -138,7 +138,7 @@ static int ali_settimer(int t)
* 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)
{
/* Can't seek (pwrite) on this device */
......@@ -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,
unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT |
......@@ -194,12 +196,12 @@ static int ali_ioctl(struct inode *inode, struct file *file,
switch (cmd) {
case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *) arg, &ident,
return copy_to_user(argp, &ident,
sizeof (ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *) arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
ali_keepalive();
......@@ -209,7 +211,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
{
int new_options, retval = -EINVAL;
if (get_user (new_options, (int *) arg))
if (get_user (new_options, p))
return -EFAULT;
if (new_options & WDIOS_DISABLECARD) {
......@@ -229,7 +231,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
{
int new_timeout;
if (get_user(new_timeout, (int *) arg))
if (get_user(new_timeout, p))
return -EFAULT;
if (ali_settimer(new_timeout))
......@@ -240,7 +242,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
}
case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg);
return put_user(timeout, p);
default:
return -ENOIOCTLCMD;
......
......@@ -148,7 +148,7 @@ static void wdt_keepalive(void)
* /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 */
if(ppos != &file->f_pos)
......@@ -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)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident =
{
.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
switch(cmd)
{
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_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
......@@ -224,7 +226,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
{
int new_options, retval = -EINVAL;
if(get_user(new_options, (int *)arg))
if(get_user(new_options, p))
return -EFAULT;
if(new_options & WDIOS_DISABLECARD) {
......@@ -243,7 +245,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
{
int new_timeout;
if(get_user(new_timeout, (int *)arg))
if(get_user(new_timeout, p))
return -EFAULT;
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
/* Fall through */
}
case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg);
return put_user(timeout, p);
default:
return -ENOIOCTLCMD;
}
......
......@@ -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)
{
void __user *argp = (void __user *)arg;
unsigned int value;
static struct watchdog_info ident =
{
......@@ -159,15 +160,15 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
case WDIOC_GETSTATUS:
value = inb(port + CPU5WDT_STATUS_REG);
value = (value >> 2) & 1;
if ( copy_to_user((int *)arg, (int *)&value, sizeof(int)) )
if ( copy_to_user(argp, &value, sizeof(int)) )
return -EFAULT;
break;
case WDIOC_GETSUPPORT:
if ( copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)) )
if ( copy_to_user(argp, &ident, sizeof(ident)) )
return -EFAULT;
break;
case WDIOC_SETOPTIONS:
if ( copy_from_user(&value, (int *)arg, sizeof(int)) )
if ( copy_from_user(&value, argp, sizeof(int)) )
return -EFAULT;
switch(value) {
case WDIOS_ENABLECARD:
......@@ -185,7 +186,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
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 )
return -EIO;
......
......@@ -196,8 +196,8 @@ static void eurwdt_ping(void)
* 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,
loff_t *ppos)
static ssize_t eurwdt_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
/* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos)
......@@ -237,6 +237,8 @@ loff_t *ppos)
static int eurwdt_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 = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1,
......@@ -251,19 +253,18 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
return -ENOIOCTLCMD;
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_GETBOOTSTATUS:
return put_user(0, (int *) arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
eurwdt_ping();
return 0;
case WDIOC_SETTIMEOUT:
if (copy_from_user(&time, (int *) arg, sizeof(int)))
if (copy_from_user(&time, p, sizeof(int)))
return -EFAULT;
/* Sanity check */
......@@ -275,10 +276,10 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(eurwdt_timeout, (int *)arg);
return put_user(eurwdt_timeout, p);
case WDIOC_SETOPTIONS:
if (get_user(options, (int *)arg))
if (get_user(options, p))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
eurwdt_disable_timer();
......
......@@ -212,7 +212,7 @@ static int i8xx_tco_release (struct inode *inode, struct file *file)
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)
{
/* Can't seek (pwrite) on this device */
......@@ -249,6 +249,8 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
{
int new_options, retval = -EINVAL;
int new_heartbeat;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING |
......@@ -259,12 +261,12 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
switch (cmd) {
case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *) arg, &ident,
return copy_to_user(argp, &ident,
sizeof (ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user (0, (int *) arg);
return put_user (0, p);
case WDIOC_KEEPALIVE:
tco_timer_keepalive ();
......@@ -272,7 +274,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
case WDIOC_SETOPTIONS:
{
if (get_user (new_options, (int *) arg))
if (get_user (new_options, p))
return -EFAULT;
if (new_options & WDIOS_DISABLECARD) {
......@@ -291,7 +293,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
case WDIOC_SETTIMEOUT:
{
if (get_user(new_heartbeat, (int *) arg))
if (get_user(new_heartbeat, p))
return -EFAULT;
if (tco_timer_set_heartbeat(new_heartbeat))
......@@ -302,7 +304,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
}
case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg);
return put_user(heartbeat, p);
default:
return -ENOIOCTLCMD;
......
......@@ -139,7 +139,7 @@ ibwdt_ping(void)
}
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 */
if (ppos != &file->f_pos)
......@@ -170,6 +170,8 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
int i, new_margin;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
......@@ -179,19 +181,19 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch (cmd) {
case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_GETSTATUS:
return put_user(0, (int *) arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
ibwdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_margin, (int *)arg))
if (get_user(new_margin, p))
return -EFAULT;
if ((new_margin < 0) || (new_margin > 30))
return -EINVAL;
......@@ -203,7 +205,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(wd_times[wd_margin], (int *)arg);
return put_user(wd_times[wd_margin], p);
break;
default:
......
......@@ -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)
{
/* 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,
static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
switch(cmd){
case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg,
&zf_info, sizeof(zf_info)))
if (copy_to_user(argp, &zf_info, sizeof(zf_info)))
return -EFAULT;
break;
case WDIOC_GETSTATUS:
return put_user(0, (int *) arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
zf_ping(0);
......
......@@ -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) {
return -ESPIPE;
......@@ -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,
unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
int status;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
......@@ -178,13 +180,12 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
if (!nowayout) {
status|=mixcomwd_timer_alive;
}
if (copy_to_user((int *)arg, &status, sizeof(int))) {
if (copy_to_user(p, &status, sizeof(int))) {
return -EFAULT;
}
break;
case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident,
sizeof(ident))) {
if (copy_to_user(argp, &ident, sizeof(ident))) {
return -EFAULT;
}
break;
......
......@@ -258,7 +258,7 @@ static int pcipcwd_get_temperature(int *temperature)
* /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)
{
/* Can't seek (pwrite) on this device */
......@@ -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,
unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_OVERHEAT |
WDIOF_CARDRESET |
......@@ -305,7 +307,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
switch (cmd) {
case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *) arg, &ident,
return copy_to_user(argp, &ident,
sizeof (ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
......@@ -314,11 +316,11 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
pcipcwd_get_status(&status);
return put_user(status, (int *) arg);
return put_user(status, p);
}
case WDIOC_GETBOOTSTATUS:
return put_user(pcipcwd_private.boot_status, (int *) arg);
return put_user(pcipcwd_private.boot_status, p);
case WDIOC_GETTEMP:
{
......@@ -327,7 +329,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
if (pcipcwd_get_temperature(&temperature))
return -EFAULT;
return put_user(temperature, (int *) arg);
return put_user(temperature, p);
}
case WDIOC_KEEPALIVE:
......@@ -338,7 +340,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
{
int new_options, retval = -EINVAL;
if (get_user (new_options, (int *) arg))
if (get_user (new_options, p))
return -EFAULT;
if (new_options & WDIOS_DISABLECARD) {
......@@ -363,7 +365,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
{
int new_heartbeat;
if (get_user(new_heartbeat, (int *) arg))
if (get_user(new_heartbeat, p))
return -EFAULT;
if (pcipcwd_set_heartbeat(new_heartbeat))
......@@ -374,7 +376,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
}
case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg);
return put_user(heartbeat, p);
default:
return -ENOIOCTLCMD;
......@@ -413,7 +415,7 @@ static int pcipcwd_release(struct inode *inode, struct file *file)
* /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)
{
int temperature;
......
......@@ -326,7 +326,7 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp
* /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)
{
/* Can't seek (pwrite) on this device */
......@@ -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,
unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT |
......@@ -371,12 +373,12 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
switch (cmd) {
case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *) arg, &ident,
return copy_to_user(argp, &ident,
sizeof (ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *) arg);
return put_user(0, p);
case WDIOC_GETTEMP:
{
......@@ -385,7 +387,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
return -EFAULT;
return put_user(temperature, (int *) arg);
return put_user(temperature, p);
}
case WDIOC_KEEPALIVE:
......@@ -396,7 +398,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
{
int new_options, retval = -EINVAL;
if (get_user (new_options, (int *) arg))
if (get_user (new_options, p))
return -EFAULT;
if (new_options & WDIOS_DISABLECARD) {
......@@ -416,7 +418,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
{
int new_heartbeat;
if (get_user(new_heartbeat, (int *) arg))
if (get_user(new_heartbeat, p))
return -EFAULT;
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,
}
case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg);
return put_user(heartbeat, p);
default:
return -ENOIOCTLCMD;
......@@ -466,7 +468,7 @@ static int usb_pcwd_release(struct inode *inode, struct file *file)
* /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)
{
int temperature;
......@@ -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))
return -EFAULT;
if (copy_to_user (data, &temperature, 1))
if (copy_to_user(data, &temperature, 1))
return -EFAULT;
return 1;
......
......@@ -166,7 +166,7 @@ static void wdt_keepalive(void)
* /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 */
if(ppos != &file->f_pos)
......@@ -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,
unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident=
{
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
......@@ -242,10 +244,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default:
return -ENOIOCTLCMD;
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_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
......@@ -253,7 +255,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int new_options, retval = -EINVAL;
if(get_user(new_options, (int *)arg))
if(get_user(new_options, p))
return -EFAULT;
if(new_options & WDIOS_DISABLECARD) {
......@@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int new_timeout;
if(get_user(new_timeout, (int *)arg))
if(get_user(new_timeout, p))
return -EFAULT;
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,
/* Fall through */
}
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)
static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
int new_timeout;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 0,
......@@ -185,22 +187,22 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
return -ENOIOCTLCMD; /* Keep Pavel Machek amused ;) */
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 0;
case WDIOC_GETSTATUS:
return put_user(sc1200wdt_status(), (int *)arg);
return put_user(sc1200wdt_status(), p);
case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
sc1200wdt_write_data(WDTO, timeout);
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *)arg))
if (get_user(new_timeout, p))
return -EFAULT;
/* the API states this is given in secs */
......@@ -213,13 +215,13 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
/* fall through and return the new timeout */
case WDIOC_GETTIMEOUT:
return put_user(timeout * 60, (int *)arg);
return put_user(timeout * 60, p);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
if (get_user(options, (int *)arg))
if (get_user(options, p))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
......@@ -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)
return -ESPIPE;
......
......@@ -225,7 +225,7 @@ static int wdt_set_heartbeat(int t)
* /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 */
if(ppos != &file->f_pos)
......@@ -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,
unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1,
......@@ -296,10 +298,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default:
return -ENOIOCTLCMD;
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_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
......@@ -307,7 +309,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int new_options, retval = -EINVAL;
if(get_user(new_options, (int *)arg))
if(get_user(new_options, p))
return -EFAULT;
if(new_options & WDIOS_DISABLECARD) {
......@@ -326,7 +328,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int new_timeout;
if(get_user(new_timeout, (int *)arg))
if(get_user(new_timeout, p))
return -EFAULT;
if(wdt_set_heartbeat(new_timeout))
......@@ -336,7 +338,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall through */
}
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 =
.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)
{
if (ppos != &file->f_pos)
......@@ -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,
unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.identity = "NatSemi SCx200 Watchdog",
.firmware_version = 1,
......@@ -174,20 +176,19 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
default:
return -ENOIOCTLCMD;
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 0;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
if (put_user(0, (int *)arg))
if (put_user(0, p))
return -EFAULT;
return 0;
case WDIOC_KEEPALIVE:
scx200_wdt_ping();
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_margin, (int *)arg))
if (get_user(new_margin, p))
return -EFAULT;
if (new_margin < 1)
return -EINVAL;
......@@ -195,7 +196,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
scx200_wdt_update_margin();
scx200_wdt_ping();
case WDIOC_GETTIMEOUT:
if (put_user(margin, (int *)arg))
if (put_user(margin, p))
return -EFAULT;
return 0;
}
......
......@@ -161,7 +161,7 @@ static int softdog_release(struct inode *inode, struct file *file)
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 */
if (ppos != &file->f_pos)
......@@ -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,
unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
int new_margin;
static struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT |
......@@ -206,23 +208,23 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
default:
return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident,
return copy_to_user(argp, &ident,
sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0,(int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
softdog_keepalive();
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_margin, (int *)arg))
if (get_user(new_margin, p))
return -EFAULT;
if (softdog_set_heartbeat(new_margin))
return -EINVAL;
softdog_keepalive();
/* Fall */
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)
}
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 */
if (ppos != &file->f_pos)
......@@ -171,6 +171,8 @@ static int
wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
int new_timeout;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
......@@ -180,20 +182,20 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch (cmd) {
case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *)arg))
if (get_user(new_timeout, p))
return -EFAULT;
if (wdt_set_heartbeat(new_timeout))
return -EINVAL;
......@@ -201,13 +203,13 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg);
return put_user(timeout, p);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
if (get_user(options, (int *)arg))
if (get_user(options, p))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
......
......@@ -188,7 +188,7 @@ static void wdt_keepalive(void)
* /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 */
if(ppos != &file->f_pos)
......@@ -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,
unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident=
{
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
......@@ -261,10 +263,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default:
return -ENOIOCTLCMD;
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_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
......@@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int new_options, retval = -EINVAL;
if(get_user(new_options, (int *)arg))
if(get_user(new_options, p))
return -EFAULT;
if(new_options & WDIOS_DISABLECARD) {
......@@ -291,7 +293,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int new_timeout;
if(get_user(new_timeout, (int *)arg))
if(get_user(new_timeout, p))
return -EFAULT;
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,
/* Fall through */
}
case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg);
return put_user(timeout, p);
}
}
......
......@@ -95,7 +95,7 @@ wafwdt_stop(void)
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 */
if (ppos != &file->f_pos)
......@@ -128,6 +128,8 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
unsigned long arg)
{
int new_timeout;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1,
......@@ -136,21 +138,20 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
switch (cmd) {
case WDIOC_GETSUPPORT:
if (copy_to_user
((struct watchdog_info *) arg, &ident, sizeof (ident)))
if (copy_to_user(argp, &ident, sizeof (ident)))
return -EFAULT;
break;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
wafwdt_ping();
break;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *)arg))
if (get_user(new_timeout, p))
return -EFAULT;
if ((new_timeout < 1) || (new_timeout > 255))
return -EINVAL;
......@@ -159,13 +160,13 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
wafwdt_start();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg);
return put_user(timeout, p);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
if (get_user(options, (int *)arg))
if (get_user(options, p))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
......
......@@ -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.
*/
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 */
if (ppos != &file->f_pos)
......@@ -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,
unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
int new_heartbeat;
int status;
......@@ -351,18 +353,18 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default:
return -ENOIOCTLCMD;
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:
wdt_get_status(&status);
return put_user(status,(int *)arg);
return put_user(status, p);
case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_ping();
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_heartbeat, (int *)arg))
if (get_user(new_heartbeat, p))
return -EFAULT;
if (wdt_set_heartbeat(new_heartbeat))
......@@ -371,7 +373,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
wdt_ping();
/* Fall */
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)
* 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;
......
......@@ -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.
*/
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 */
if (ppos != &file->f_pos)
......@@ -374,6 +374,8 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
{
int new_heartbeat;
int status;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT|
......@@ -396,18 +398,18 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
default:
return -ENOIOCTLCMD;
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:
wdtpci_get_status(&status);
return put_user(status,(int *)arg);
return put_user(status, p);
case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *)arg);
return put_user(0, p);
case WDIOC_KEEPALIVE:
wdtpci_ping();
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_heartbeat, (int *)arg))
if (get_user(new_heartbeat, p))
return -EFAULT;
if (wdtpci_set_heartbeat(new_heartbeat))
......@@ -416,7 +418,7 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
wdtpci_ping();
/* Fall */
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)
* 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;
......
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