* [PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint()
@ 2021-05-24 12:08 Liu Shixin
2021-05-24 21:57 ` Eric Biggers
0 siblings, 1 reply; 5+ messages in thread
From: Liu Shixin @ 2021-05-24 12:08 UTC (permalink / raw)
To: Herbert Xu, David S. Miller; +Cc: linux-crypto, linux-kernel, Liu Shixin
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, ¶m->attrs[i].nu32.data.num)))
+ goto err_free_param;
}
param->tb[i + 1] = ¶m->attrs[i].attr;
--
2.18.0.huawei.25
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint()
2021-05-24 12:08 [PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint() Liu Shixin
@ 2021-05-24 21:57 ` Eric Biggers
2021-06-03 8:12 ` Herbert Xu
0 siblings, 1 reply; 5+ messages in thread
From: Eric Biggers @ 2021-05-24 21:57 UTC (permalink / raw)
To: Liu Shixin; +Cc: Herbert Xu, David S. Miller, linux-crypto, linux-kernel
On Mon, May 24, 2021 at 08:08:34PM +0800, Liu Shixin wrote:
> 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, ¶m->attrs[i].nu32.data.num)))
> + goto err_free_param;
It would be better to just remove all the code related to CRYPTOA_U32 and
crypto_attr_u32, as it is never used.
- Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint()
2021-05-24 21:57 ` Eric Biggers
@ 2021-06-03 8:12 ` Herbert Xu
2021-06-03 10:53 ` Liu Shixin
0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2021-06-03 8:12 UTC (permalink / raw)
To: Eric Biggers; +Cc: Liu Shixin, David S. Miller, linux-crypto, linux-kernel
On Mon, May 24, 2021 at 02:57:50PM -0700, Eric Biggers wrote:
>
> It would be better to just remove all the code related to CRYPTOA_U32 and
> crypto_attr_u32, as it is never used.
I agree, it's been unused for over a decade.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint()
2021-06-03 8:12 ` Herbert Xu
@ 2021-06-03 10:53 ` Liu Shixin
2021-06-03 11:50 ` Herbert Xu
0 siblings, 1 reply; 5+ messages in thread
From: Liu Shixin @ 2021-06-03 10:53 UTC (permalink / raw)
To: Herbert Xu, Eric Biggers; +Cc: David S. Miller, linux-crypto, linux-kernel
On 2021/6/3 16:12, Herbert Xu wrote:
> On Mon, May 24, 2021 at 02:57:50PM -0700, Eric Biggers wrote:
>> It would be better to just remove all the code related to CRYPTOA_U32 and
>> crypto_attr_u32, as it is never used.
> I agree, it's been unused for over a decade.
>
> Thanks,
Thank you both for the advice, I will fix it.
Besides, I noticed that type CRYPTOA_UNSPEC has never been used, should I remove it together?
Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint()
2021-06-03 10:53 ` Liu Shixin
@ 2021-06-03 11:50 ` Herbert Xu
0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2021-06-03 11:50 UTC (permalink / raw)
To: Liu Shixin; +Cc: Eric Biggers, David S. Miller, linux-crypto, linux-kernel
On Thu, Jun 03, 2021 at 06:53:00PM +0800, Liu Shixin wrote:
>
> Besides, I noticed that type CRYPTOA_UNSPEC has never been used, should I remove it together?
No please leave it alone.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-03 11:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 12:08 [PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint() Liu Shixin
2021-05-24 21:57 ` Eric Biggers
2021-06-03 8:12 ` Herbert Xu
2021-06-03 10:53 ` Liu Shixin
2021-06-03 11:50 ` Herbert Xu
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).