ipheth: potential null dereferences on error path
[safe/jmp/linux-2.6] / drivers / watchdog / mixcomwd.c
index 2248a81..bc820d1 100644 (file)
@@ -201,13 +201,17 @@ static long mixcomwd_ioctl(struct file *file,
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int status;
-       static struct watchdog_info ident = {
+       static const struct watchdog_info ident = {
                .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = "MixCOM watchdog",
        };
 
        switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               if (copy_to_user(argp, &ident, sizeof(ident)))
+                       return -EFAULT;
+               break;
        case WDIOC_GETSTATUS:
                status = mixcomwd_opened;
                if (!nowayout)
@@ -215,10 +219,6 @@ static long mixcomwd_ioctl(struct file *file,
                return put_user(status, p);
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, p);
-       case WDIOC_GETSUPPORT:
-               if (copy_to_user(argp, &ident, sizeof(ident)))
-                       return -EFAULT;
-               break;
        case WDIOC_KEEPALIVE:
                mixcomwd_ping();
                break;