[PATCH] mv64x60_wdt __user annotations and cleanups

- use nonseekable_open() instead of messing with

	if (*ppos != file->f_pos)
		return -EISPIPE

   in ->write() (->read is NULL).

 - trivial __user annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Al Viro 2005-09-29 00:42:27 +01:00 committed by Linus Torvalds
parent ae8aed0314
commit b2846dfa4a

View File

@ -87,6 +87,8 @@ static int mv64x60_wdt_open(struct inode *inode, struct file *file)
mv64x60_wdt_service(); mv64x60_wdt_service();
mv64x60_wdt_handler_enable(); mv64x60_wdt_handler_enable();
nonseekable_open(inode, file);
return 0; return 0;
} }
@ -103,12 +105,9 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static ssize_t mv64x60_wdt_write(struct file *file, const char *data, static ssize_t mv64x60_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)
return -ESPIPE;
if (len) if (len)
mv64x60_wdt_service(); mv64x60_wdt_service();
@ -119,6 +118,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
int timeout; int timeout;
void __user *argp = (void __user *)arg;
static struct watchdog_info info = { static struct watchdog_info info = {
.options = WDIOF_KEEPALIVEPING, .options = WDIOF_KEEPALIVEPING,
.firmware_version = 0, .firmware_version = 0,
@ -127,13 +127,13 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((void *)arg, &info, sizeof(info))) if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT; return -EFAULT;
break; break;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
if (put_user(wdt_status, (int *)arg)) if (put_user(wdt_status, (int __user *)argp))
return -EFAULT; return -EFAULT;
wdt_status &= ~WDIOF_KEEPALIVEPING; wdt_status &= ~WDIOF_KEEPALIVEPING;
break; break;
@ -154,7 +154,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
timeout = mv64x60_wdt_timeout * HZ; timeout = mv64x60_wdt_timeout * HZ;
if (put_user(timeout, (int *)arg)) if (put_user(timeout, (int __user *)argp))
return -EFAULT; return -EFAULT;
break; break;