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 <herbert@gondor.apana.org.au>
Acked-by: John Allen <john.allen@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Herbert Xu 2020-07-09 22:44:04 +10:00
Родитель 8832cfd3a0
Коммит 2c2e18369f
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -19,6 +19,7 @@
#include <crypto/internal/hash.h> #include <crypto/internal/hash.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <crypto/scatterwalk.h> #include <crypto/scatterwalk.h>
#include <linux/string.h>
#include "ccp-crypto.h" #include "ccp-crypto.h"
@ -424,7 +425,7 @@ static int ccp_register_hmac_alg(struct list_head *head,
*ccp_alg = *base_alg; *ccp_alg = *base_alg;
INIT_LIST_HEAD(&ccp_alg->entry); 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 = &ccp_alg->alg;
alg->setkey = ccp_sha_setkey; alg->setkey = ccp_sha_setkey;