* [PATCH -next] sunrpc: use kmemdup_nul() in gssp_stringify()
@ 2020-05-08 12:40 Chen Zhou
2020-06-08 15:25 ` J. Bruce Fields
0 siblings, 1 reply; 2+ messages in thread
From: Chen Zhou @ 2020-05-08 12:40 UTC (permalink / raw)
To: trond.myklebust, anna.schumaker, bfields, chuck.lever, davem, kuba
Cc: linux-nfs, netdev, linux-kernel, chenzhou10
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>
---
net/sunrpc/auth_gss/gss_rpc_upcall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c
index 0349f455a862..af9c7f43859c 100644
--- a/net/sunrpc/auth_gss/gss_rpc_upcall.c
+++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c
@@ -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)
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] sunrpc: use kmemdup_nul() in gssp_stringify()
2020-05-08 12:40 [PATCH -next] sunrpc: use kmemdup_nul() in gssp_stringify() Chen Zhou
@ 2020-06-08 15:25 ` J. Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2020-06-08 15:25 UTC (permalink / raw)
To: Chen Zhou
Cc: trond.myklebust, anna.schumaker, chuck.lever, davem, kuba,
linux-nfs, netdev, linux-kernel
Thanks, applied.--b.
On Fri, May 08, 2020 at 08:40:00PM +0800, Chen Zhou wrote:
> 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>
> ---
> net/sunrpc/auth_gss/gss_rpc_upcall.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c
> index 0349f455a862..af9c7f43859c 100644
> --- a/net/sunrpc/auth_gss/gss_rpc_upcall.c
> +++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c
> @@ -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)
> --
> 2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-08 15:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 12:40 [PATCH -next] sunrpc: use kmemdup_nul() in gssp_stringify() Chen Zhou
2020-06-08 15:25 ` J. Bruce Fields
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).