cifs: NULL dereference on allocation failure
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 24 Jan 2012 08:39:22 +0000 (11:39 +0300)
committerSteve French <smfrench@gmail.com>
Tue, 24 Jan 2012 16:37:19 +0000 (10:37 -0600)
We should just return directly here, the goto causes a NULL dereference.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/connect.c

index 986709a..026d646 100644 (file)
@@ -3857,10 +3857,8 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
        struct smb_vol *vol_info;
 
        vol_info = kzalloc(sizeof(*vol_info), GFP_KERNEL);
-       if (vol_info == NULL) {
-               tcon = ERR_PTR(-ENOMEM);
-               goto out;
-       }
+       if (vol_info == NULL)
+               return ERR_PTR(-ENOMEM);
 
        vol_info->local_nls = cifs_sb->local_nls;
        vol_info->linux_uid = fsuid;