diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2023-07-25 15:31:47 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-08-29 20:30:19 +0300 |
commit | 084ba46fc41c21ba827fd92e61f78def7a6e52ea (patch) | |
tree | 1444bb049ce98eb27ceb6563b3213adb2d52c934 /fs/smb/server/asn1.c | |
parent | 2dde18cd1d8fac735875f2e4987f11817cc0bc2c (diff) | |
download | linux-084ba46fc41c21ba827fd92e61f78def7a6e52ea.tar.xz |
ksmbd: switch to use kmemdup_nul() helper
Use kmemdup_nul() helper instead of open-coding to
simplify the code.
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/server/asn1.c')
-rw-r--r-- | fs/smb/server/asn1.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/smb/server/asn1.c b/fs/smb/server/asn1.c index cc6384f79675..4a4b2b03ff33 100644 --- a/fs/smb/server/asn1.c +++ b/fs/smb/server/asn1.c @@ -214,12 +214,10 @@ static int ksmbd_neg_token_alloc(void *context, size_t hdrlen, { struct ksmbd_conn *conn = context; - conn->mechToken = kmalloc(vlen + 1, GFP_KERNEL); + conn->mechToken = kmemdup_nul(value, vlen, GFP_KERNEL); if (!conn->mechToken) return -ENOMEM; - memcpy(conn->mechToken, value, vlen); - conn->mechToken[vlen] = '\0'; return 0; } |