X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fwatchdog%2Fadvantechwdt.c;h=ea73c8379bdda6c67cb591b80fe53c3d9fa3c641;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=a92b3ae02ac4e864716118fe2fdd6a9b382028c9;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/char/watchdog/advantechwdt.c b/drivers/char/watchdog/advantechwdt.c index a92b3ae02..ea73c8379 100644 --- a/drivers/char/watchdog/advantechwdt.c +++ b/drivers/char/watchdog/advantechwdt.c @@ -100,12 +100,8 @@ 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) - return -ESPIPE; - if (count) { if (!nowayout) { size_t i; @@ -130,6 +126,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 +136,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 +158,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) { @@ -198,7 +196,7 @@ advwdt_open(struct inode *inode, struct file *file) */ advwdt_ping(); - return 0; + return nonseekable_open(inode, file); } static int