* [PATCH] crypto: af_alg - use sock_kmemdup in alg_setkey_by_key_serial
@ 2026-04-05 19:49 Thorsten Blum
2026-04-12 9:17 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-04-05 19:49 UTC (permalink / raw)
To: Herbert Xu, David S. Miller; +Cc: Thorsten Blum, linux-crypto, linux-kernel
Replace sock_kmalloc() followed by memcpy() with sock_kmemdup() to
simplify alg_setkey_by_key_serial().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
crypto/af_alg.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 8e0199394984..25d2bfae31dc 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -324,15 +324,13 @@ static int alg_setkey_by_key_serial(struct alg_sock *ask, sockptr_t optval,
return PTR_ERR(ret);
}
- key_data = sock_kmalloc(&ask->sk, key_datalen, GFP_KERNEL);
+ key_data = sock_kmemdup(&ask->sk, ret, key_datalen, GFP_KERNEL);
if (!key_data) {
up_read(&key->sem);
key_put(key);
return -ENOMEM;
}
- memcpy(key_data, ret, key_datalen);
-
up_read(&key->sem);
key_put(key);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: af_alg - use sock_kmemdup in alg_setkey_by_key_serial
2026-04-05 19:49 [PATCH] crypto: af_alg - use sock_kmemdup in alg_setkey_by_key_serial Thorsten Blum
@ 2026-04-12 9:17 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-04-12 9:17 UTC (permalink / raw)
To: Thorsten Blum; +Cc: David S. Miller, linux-crypto, linux-kernel
On Sun, Apr 05, 2026 at 09:49:41PM +0200, Thorsten Blum wrote:
> Replace sock_kmalloc() followed by memcpy() with sock_kmemdup() to
> simplify alg_setkey_by_key_serial().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> crypto/af_alg.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Patch applied. 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] 2+ messages in thread
end of thread, other threads:[~2026-04-12 9:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-05 19:49 [PATCH] crypto: af_alg - use sock_kmemdup in alg_setkey_by_key_serial Thorsten Blum
2026-04-12 9:17 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome