From: Jeff Layton <jlayton@kernel.org>
To: Su Hui <suhui@nfschina.com>,
chuck.lever@oracle.com, neilb@suse.de, okorniev@redhat.com,
Dai.Ngo@oracle.com, tom@talpey.com
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] nfsd: Replace simple_strtoul with kstrtoint in expkey_parse
Date: Wed, 28 May 2025 07:11:19 -0400 [thread overview]
Message-ID: <3bd1932129f4221a7affc5a6bf1ea5367dcb6a7c.camel@kernel.org> (raw)
In-Reply-To: <20250527092548.1931636-1-suhui@nfschina.com>
On Tue, 2025-05-27 at 17:25 +0800, Su Hui wrote:
> kstrtoint() is better because simple_strtoul() ignores overflow and the
> type of 'fsidtype' is 'int' rather than 'unsigned long'.
>
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
> fs/nfsd/export.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index 0363720280d4..1bc9bc20cac3 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -83,7 +83,6 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
> struct auth_domain *dom = NULL;
> int err;
> int fsidtype;
> - char *ep;
> struct svc_expkey key;
> struct svc_expkey *ek = NULL;
>
> @@ -109,8 +108,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
> err = -EINVAL;
> if (qword_get(&mesg, buf, PAGE_SIZE) <= 0)
> goto out;
> - fsidtype = simple_strtoul(buf, &ep, 10);
> - if (*ep)
> + if (kstrtoint(buf, 10, &fsidtype))
> goto out;
> dprintk("found fsidtype %d\n", fsidtype);
> if (key_len(fsidtype)==0) /* invalid type */
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2025-05-28 11:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 9:25 [PATCH] nfsd: Replace simple_strtoul with kstrtoint in expkey_parse Su Hui
2025-05-28 0:25 ` NeilBrown
2025-05-29 2:15 ` Su Hui
2025-05-28 11:11 ` Jeff Layton [this message]
2025-05-28 14:10 ` cel
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=3bd1932129f4221a7affc5a6bf1ea5367dcb6a7c.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=okorniev@redhat.com \
--cc=suhui@nfschina.com \
--cc=tom@talpey.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