From: Chuck Lever III <chuck.lever@oracle.com>
To: Azeem Shaikh <azeemshaikh38@gmail.com>
Cc: Jeff Layton <jlayton@kernel.org>,
Kees Cook <keescook@chromium.org>,
"linux-hardening@vger.kernel.org"
<linux-hardening@vger.kernel.org>, Neil Brown <neilb@suse.de>,
Olga Kornievskaia <kolga@netapp.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH v3] SUNRPC: Use sysfs_emit in place of strlcpy/sprintf
Date: Wed, 14 Jun 2023 17:01:18 +0000 [thread overview]
Message-ID: <9208246C-491E-4DA8-9EB3-76F4216B4D4F@oracle.com> (raw)
In-Reply-To: <20230614133757.2106902-1-azeemshaikh38@gmail.com>
> On Jun 14, 2023, at 9:37 AM, Azeem Shaikh <azeemshaikh38@gmail.com> wrote:
>
> Part of an effort to remove strlcpy() tree-wide [1].
>
> Direct replacement is safe here since the getter in kernel_params_ops
> handles -errno return [2].
>
> [1] https://github.com/KSPP/linux/issues/89
> [2] https://elixir.bootlin.com/linux/v6.4-rc6/source/include/linux/moduleparam.h#L52
>
> Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Thank you! Applied to nfsd-next.
> ---
> net/sunrpc/svc.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> index e6d4cec61e47..b011c318fef1 100644
> --- a/net/sunrpc/svc.c
> +++ b/net/sunrpc/svc.c
> @@ -109,15 +109,15 @@ param_get_pool_mode(char *buf, const struct kernel_param *kp)
> switch (*ip)
> {
> case SVC_POOL_AUTO:
> - return strlcpy(buf, "auto\n", 20);
> + return sysfs_emit(buf, "auto\n");
> case SVC_POOL_GLOBAL:
> - return strlcpy(buf, "global\n", 20);
> + return sysfs_emit(buf, "global\n");
> case SVC_POOL_PERCPU:
> - return strlcpy(buf, "percpu\n", 20);
> + return sysfs_emit(buf, "percpu\n");
> case SVC_POOL_PERNODE:
> - return strlcpy(buf, "pernode\n", 20);
> + return sysfs_emit(buf, "pernode\n");
> default:
> - return sprintf(buf, "%d\n", *ip);
> + return sysfs_emit(buf, "%d\n", *ip);
> }
> }
>
> --
> 2.41.0.162.gfafddb0af9-goog
>
>
--
Chuck Lever
prev parent reply other threads:[~2023-06-14 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 13:37 [PATCH v3] SUNRPC: Use sysfs_emit in place of strlcpy/sprintf Azeem Shaikh
2023-06-14 17:01 ` Chuck Lever III [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=9208246C-491E-4DA8-9EB3-76F4216B4D4F@oracle.com \
--to=chuck.lever@oracle.com \
--cc=anna@kernel.org \
--cc=azeemshaikh38@gmail.com \
--cc=dai.ngo@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jlayton@kernel.org \
--cc=keescook@chromium.org \
--cc=kolga@netapp.com \
--cc=kuba@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tom@talpey.com \
--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;
as well as URLs for NNTP newsgroup(s).