summaryrefslogtreecommitdiff
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index a83684d8eb5a..5f2ec1946776 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3386,9 +3386,11 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
kfree(tcon->nativeFileSystem);
tcon->nativeFileSystem =
kzalloc(length + 2, GFP_KERNEL);
- cifs_strfromUCS_le(tcon->nativeFileSystem,
- (__le16 *) bcc_ptr,
- length, nls_codepage);
+ if (tcon->nativeFileSystem)
+ cifs_strfromUCS_le(
+ tcon->nativeFileSystem,
+ (__le16 *) bcc_ptr,
+ length, nls_codepage);
bcc_ptr += 2 * length;
bcc_ptr[0] = 0; /* null terminate the string */
bcc_ptr[1] = 0;
@@ -3403,8 +3405,9 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
kfree(tcon->nativeFileSystem);
tcon->nativeFileSystem =
kzalloc(length + 1, GFP_KERNEL);
- strncpy(tcon->nativeFileSystem, bcc_ptr,
- length);
+ if (tcon->nativeFileSystem)
+ strncpy(tcon->nativeFileSystem, bcc_ptr,
+ length);
}
/* else do not bother copying these information fields*/
}