X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fwatchdog%2Fwdt.c;h=5684aa37988611d4525824d5e6401ee70426a9f8;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=c606ce4336f46864d6506f5cf86dbe54229fe650;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c index c606ce433..5684aa379 100644 --- a/drivers/char/watchdog/wdt.c +++ b/drivers/char/watchdog/wdt.c @@ -286,12 +286,8 @@ 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) - return -ESPIPE; - if(count) { if (!nowayout) { size_t i; @@ -327,6 +323,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 +349,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 +369,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); } } @@ -395,7 +393,7 @@ static int wdt_open(struct inode *inode, struct file *file) * Activate */ wdt_start(); - return 0; + return nonseekable_open(inode, file); } /** @@ -435,14 +433,10 @@ 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; - /* Can't seek (pread) on this device */ - if (ptr != &file->f_pos) - return -ESPIPE; - if (wdt_get_temperature(&temperature)) return -EFAULT; @@ -462,7 +456,7 @@ static ssize_t wdt_temp_read(struct file *file, char *buf, size_t count, loff_t static int wdt_temp_open(struct inode *inode, struct file *file) { - return 0; + return nonseekable_open(inode, file); } /**