public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chen Zhou <chenzhou10@huawei.com>
Cc: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com,
	chuck.lever@oracle.com, davem@davemloft.net, kuba@kernel.org,
	linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] sunrpc: use kmemdup_nul() in gssp_stringify()
Date: Mon, 8 Jun 2020 11:25:25 -0400	[thread overview]
Message-ID: <20200608152525.GA30639@fieldses.org> (raw)
In-Reply-To: <20200508124000.170708-1-chenzhou10@huawei.com>

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

      reply	other threads:[~2020-06-08 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200608152525.GA30639@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=anna.schumaker@netapp.com \
    --cc=chenzhou10@huawei.com \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox