linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Shixin <liushixin2@huawei.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: <linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Liu Shixin <liushixin2@huawei.com>
Subject: [PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint()
Date: Mon, 24 May 2021 20:08:34 +0800	[thread overview]
Message-ID: <20210524120834.1580343-1-liushixin2@huawei.com> (raw)

The simple_strtol() function is deprecated in some situation since
it does not check for the range overflow. Use kstrtouint() instead.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
 crypto/algboss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crypto/algboss.c b/crypto/algboss.c
index 5ebccbd6b74e..64bb8dab9584 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -140,8 +140,8 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
 			param->attrs[i].nu32.attr.rta_len =
 				sizeof(param->attrs[i].nu32);
 			param->attrs[i].nu32.attr.rta_type = CRYPTOA_U32;
-			param->attrs[i].nu32.data.num =
-				simple_strtol(name, NULL, 0);
+			if (unlikely(kstrtouint(name, 0, &param->attrs[i].nu32.data.num)))
+				goto err_free_param;
 		}
 
 		param->tb[i + 1] = &param->attrs[i].attr;
-- 
2.18.0.huawei.25


             reply	other threads:[~2021-05-24 11:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24 12:08 Liu Shixin [this message]
2021-05-24 21:57 ` [PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint() Eric Biggers
2021-06-03  8:12   ` Herbert Xu
2021-06-03 10:53     ` Liu Shixin
2021-06-03 11:50       ` Herbert Xu

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=20210524120834.1580343-1-liushixin2@huawei.com \
    --to=liushixin2@huawei.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).