tree-wide: fix assorted typos all over the place
[safe/jmp/linux-2.6] / fs / ncpfs / ioctl.c
index 6d04e05..ec8f45f 100644 (file)
@@ -98,7 +98,7 @@ struct compat_ncp_objectname_ioctl
 {
        s32             auth_type;
        u32             object_name_len;
-       compat_caddr_t  object_name;    /* an userspace data, in most cases user name */
+       compat_caddr_t  object_name;    /* a userspace data, in most cases user name */
 };
 
 struct compat_ncp_fs_info_v2 {
@@ -223,10 +223,8 @@ ncp_set_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg)
        oldset_io = server->nls_io;
        server->nls_io = iocharset;
 
-       if (oldset_cp)
-               unload_nls(oldset_cp);
-       if (oldset_io)
-               unload_nls(oldset_io);
+       unload_nls(oldset_cp);
+       unload_nls(oldset_io);
 
        return 0;
 }
@@ -442,7 +440,7 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp,
                        if (dentry) {
                                struct inode* s_inode = dentry->d_inode;
                                
-                               if (inode) {
+                               if (s_inode) {
                                        NCP_FINFO(s_inode)->volNumber = vnum;
                                        NCP_FINFO(s_inode)->dirEntNum = de;
                                        NCP_FINFO(s_inode)->DosDirNum = dosde;
@@ -660,13 +658,10 @@ outrel:
                        if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN)
                                return -ENOMEM;
                        if (user.object_name_len) {
-                               newname = kmalloc(user.object_name_len, GFP_USER);
-                               if (!newname)
-                                       return -ENOMEM;
-                               if (copy_from_user(newname, user.object_name, user.object_name_len)) {
-                                       kfree(newname);
-                                       return -EFAULT;
-                               }
+                               newname = memdup_user(user.object_name,
+                                                     user.object_name_len);
+                               if (IS_ERR(newname))
+                                       return PTR_ERR(newname);
                        } else {
                                newname = NULL;
                        }
@@ -760,13 +755,9 @@ outrel:
                        if (user.len > NCP_PRIVATE_DATA_MAX_LEN)
                                return -ENOMEM;
                        if (user.len) {
-                               new = kmalloc(user.len, GFP_USER);
-                               if (!new)
-                                       return -ENOMEM;
-                               if (copy_from_user(new, user.data, user.len)) {
-                                       kfree(new);
-                                       return -EFAULT;
-                               }
+                               new = memdup_user(user.data, user.len);
+                               if (IS_ERR(new))
+                                       return PTR_ERR(new);
                        } else {
                                new = NULL;
                        }
@@ -844,7 +835,7 @@ static int ncp_ioctl_need_write(unsigned int cmd)
        case NCP_IOC_SETROOT:
                return 0;
        default:
-               /* unkown IOCTL command, assume write */
+               /* unknown IOCTL command, assume write */
                return 1;
        }
 }