From: Herbert Xu Date: Thu, 9 Jul 2020 12:44:04 +0000 (+1000) Subject: crypto: ccp - Silence strncpy warning X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=2c2e18369f62da8217be0fbca3b94160da75cba3;p=linux.git crypto: ccp - Silence strncpy warning This patch kills an strncpy by using strscpy instead. The name would be silently truncated if it is too long. Signed-off-by: Herbert Xu Acked-by: John Allen Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/ccp/ccp-crypto-sha.c b/drivers/crypto/ccp/ccp-crypto-sha.c index b0cc2bd73af80..2bc29736fa45e 100644 --- a/drivers/crypto/ccp/ccp-crypto-sha.c +++ b/drivers/crypto/ccp/ccp-crypto-sha.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "ccp-crypto.h" @@ -424,7 +425,7 @@ static int ccp_register_hmac_alg(struct list_head *head, *ccp_alg = *base_alg; INIT_LIST_HEAD(&ccp_alg->entry); - strncpy(ccp_alg->child_alg, def->name, CRYPTO_MAX_ALG_NAME); + strscpy(ccp_alg->child_alg, def->name, CRYPTO_MAX_ALG_NAME); alg = &ccp_alg->alg; alg->setkey = ccp_sha_setkey;