Commit edf86c9b authored by Ben Dooks's avatar Ben Dooks Committed by Wim Van Sebroeck

[WATCHDOG] wdt285: fix sparse warnings

The wdt285.c watchdog driver is producing a number of
sparse errors due to missing __user attributes to calls
to put_user and copy_to_user, as well as in the prototype
of watchdog_write.

wdt285.c:144:21: warning: incorrect type in argument 1 (different address spaces)
wdt285.c:144:21:    expected void [noderef] <asn:1>*to
wdt285.c:144:21:    got void *<noident>
wdt285.c:150:9: warning: incorrect type in initializer (different address spaces)
wdt285.c:150:9:    expected int const [noderef] <asn:1>*register __p
wdt285.c:150:9:    got int *<noident>
wdt285.c:159:9: warning: incorrect type in initializer (different address spaces)
wdt285.c:159:9:    expected int const [noderef] <asn:1>*register __p
wdt285.c:159:9:    got int *<noident>
wdt285.c:174:9: warning: incorrect type in initializer (different address spaces)
wdt285.c:174:9:    expected int const [noderef] <asn:1>*register __p
wdt285.c:174:9:    got int *<noident>
wdt285.c:183:12: warning: incorrect type in initializer (incompatible argument 2 (different address spaces))
wdt285.c:183:12:    expected int ( *write )( ... )
wdt285.c:183:12:    got int ( static [toplevel] *<noident> )( ... )
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 7f605ac0
...@@ -115,8 +115,8 @@ static int watchdog_release(struct inode *inode, struct file *file) ...@@ -115,8 +115,8 @@ static int watchdog_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static ssize_t watchdog_write(struct file *file, const char *data, static ssize_t watchdog_write(struct file *file, const char __user *data,
size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
/* /*
* Refresh the timer. * Refresh the timer.
...@@ -133,21 +133,22 @@ static const struct watchdog_info ident = { ...@@ -133,21 +133,22 @@ static const struct watchdog_info ident = {
}; };
static long watchdog_ioctl(struct file *file, unsigned int cmd, static long watchdog_ioctl(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
unsigned int new_margin; unsigned int new_margin;
int __user *int_arg = (int __user *)arg;
int ret = -ENOTTY; int ret = -ENOTTY;
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
ret = 0; ret = 0;
if (copy_to_user((void *)arg, &ident, sizeof(ident))) if (copy_to_user((void __user *)arg, &ident, sizeof(ident)))
ret = -EFAULT; ret = -EFAULT;
break; break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
ret = put_user(0, (int *)arg); ret = put_user(0, int_arg);
break; break;
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
...@@ -156,7 +157,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, ...@@ -156,7 +157,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
break; break;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
ret = get_user(new_margin, (int *)arg); ret = get_user(new_margin, int_arg);
if (ret) if (ret)
break; break;
...@@ -171,7 +172,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, ...@@ -171,7 +172,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
watchdog_ping(); watchdog_ping();
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
ret = put_user(soft_margin, (int *)arg); ret = put_user(soft_margin, int_arg);
break; break;
} }
return ret; return ret;
......
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