Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: af_alg - use sock_kmemdup in alg_setkey_by_key_serial

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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Thorsten Blum and committed by
Herbert Xu
8879a3c1 c697c5fc

+1 -3
+1 -3
crypto/af_alg.c
··· 324 324 return PTR_ERR(ret); 325 325 } 326 326 327 - key_data = sock_kmalloc(&ask->sk, key_datalen, GFP_KERNEL); 327 + key_data = sock_kmemdup(&ask->sk, ret, key_datalen, GFP_KERNEL); 328 328 if (!key_data) { 329 329 up_read(&key->sem); 330 330 key_put(key); 331 331 return -ENOMEM; 332 332 } 333 - 334 - memcpy(key_data, ret, key_datalen); 335 333 336 334 up_read(&key->sem); 337 335 key_put(key);