VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / char / watchdog / mixcomwd.c
index 6d3e7d5..15a3547 100644 (file)
@@ -108,7 +108,7 @@ static int mixcomwd_open(struct inode *inode, struct file *file)
                        mixcomwd_timer_alive=0;
                }
        }
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int mixcomwd_release(struct inode *inode, struct file *file)
@@ -134,12 +134,8 @@ 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;
-       }
-
        if(len)
        {
                if (!nowayout) {
@@ -164,6 +160,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 +176,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;