Skip to content

Commit dd4f8ee

Browse files
Wolfram Sangherbertx
Wolfram Sang
authored andcommitted
crypto: core - move from strlcpy with unused retval to strscpy
Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 62f58b1 commit dd4f8ee

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

crypto/api.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask)
114114
larval->alg.cra_priority = -1;
115115
larval->alg.cra_destroy = crypto_larval_destroy;
116116

117-
strlcpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME);
117+
strscpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME);
118118
init_completion(&larval->completion);
119119

120120
return larval;

crypto/essiv.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ static int essiv_create(struct crypto_template *tmpl, struct rtattr **tb)
543543
}
544544

545545
/* record the driver name so we can instantiate this exact algo later */
546-
strlcpy(ictx->shash_driver_name, hash_alg->base.cra_driver_name,
546+
strscpy(ictx->shash_driver_name, hash_alg->base.cra_driver_name,
547547
CRYPTO_MAX_ALG_NAME);
548548

549549
/* Instance fields */

0 commit comments

Comments
 (0)