Thread (5 messages) 5 messages, 3 authors, 2021-06-03

[PATCH -next] crypto: algboss - Replaced simple_strtol() with kstrtouint()

flat view
STALE1977d

From: Liu Shixin <hidden>
Date: 2021-05-24 11:35:49
Also in: lkml
Subsystem: crypto api, the rest · Maintainers: Herbert Xu, "David S. Miller", Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help