sunrpc: use kmemdup_nul() in gssp_stringify()
authorChen Zhou <chenzhou10@huawei.com>
Fri, 8 May 2020 12:40:00 +0000 (20:40 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 8 Jun 2020 14:51:32 +0000 (10:51 -0400)
It is more efficient to use kmemdup_nul() if the size is known exactly
.

According to doc:
"Note: Use kmemdup_nul() instead if the size is known exactly."

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/auth_gss/gss_rpc_upcall.c

index 0349f455a8624fbb6c68e0da2385bf4c5e6fb539..af9c7f43859c44c83367720d59c4484107d01fc8 100644 (file)
@@ -223,7 +223,7 @@ static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg)
 
 static char *gssp_stringify(struct xdr_netobj *netobj)
 {
-       return kstrndup(netobj->data, netobj->len, GFP_KERNEL);
+       return kmemdup_nul(netobj->data, netobj->len, GFP_KERNEL);
 }
 
 static void gssp_hostbased_service(char **principal)