[PATCH] __user annotations (booke_wdt.c)
authorAl Viro <viro@ftp.linux.org.uk>
Thu, 15 Dec 2005 09:18:20 +0000 (09:18 +0000)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 15 Dec 2005 18:04:30 +0000 (10:04 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/watchdog/booke_wdt.c

index 65830ec71042f0a2fd64666775138ce491bf3066..c800cce73c1e7b5cec6b5eac97ba990c825092c0 100644 (file)
@@ -72,7 +72,7 @@ static __inline__ void booke_wdt_ping(void)
 /*
  * booke_wdt_write:
  */
-static ssize_t booke_wdt_write (struct file *file, const char *buf,
+static ssize_t booke_wdt_write (struct file *file, const char __user *buf,
                                size_t count, loff_t *ppos)
 {
        booke_wdt_ping();
@@ -92,14 +92,15 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
                            unsigned int cmd, unsigned long arg)
 {
        u32 tmp = 0;
+       u32 __user *p = (u32 __user *)arg;
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-               if (copy_to_user ((struct watchdog_info *) arg, &ident,
+               if (copy_to_user ((struct watchdog_info __user *) arg, &ident,
                                sizeof(struct watchdog_info)))
                        return -EFAULT;
        case WDIOC_GETSTATUS:
-               return put_user(ident.options, (u32 *) arg);
+               return put_user(ident.options, p);
        case WDIOC_GETBOOTSTATUS:
                /* XXX: something is clearing TSR */
                tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
@@ -109,14 +110,14 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
                booke_wdt_ping();
                return 0;
        case WDIOC_SETTIMEOUT:
-               if (get_user(booke_wdt_period, (u32 *) arg))
+               if (get_user(booke_wdt_period, p))
                        return -EFAULT;
                mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
                return 0;
        case WDIOC_GETTIMEOUT:
-               return put_user(booke_wdt_period, (u32 *) arg);
+               return put_user(booke_wdt_period, p);
        case WDIOC_SETOPTIONS:
-               if (get_user(tmp, (u32 *) arg))
+               if (get_user(tmp, p))
                        return -EINVAL;
                if (tmp == WDIOS_ENABLECARD) {
                        booke_wdt_ping();