* [PATCH] crypto: ccp - Silence strncpy warning
@ 2020-07-09 12:44 Herbert Xu
2020-07-09 18:14 ` John Allen
0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2020-07-09 12:44 UTC (permalink / raw)
To: Linux Crypto Mailing List, Tom Lendacky, John Allen
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>
diff --git a/drivers/crypto/ccp/ccp-crypto-sha.c b/drivers/crypto/ccp/ccp-crypto-sha.c
index b0cc2bd73af8..2bc29736fa45 100644
--- a/drivers/crypto/ccp/ccp-crypto-sha.c
+++ b/drivers/crypto/ccp/ccp-crypto-sha.c
@@ -19,6 +19,7 @@
#include <crypto/internal/hash.h>
#include <crypto/sha.h>
#include <crypto/scatterwalk.h>
+#include <linux/string.h>
#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;
--
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 related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: ccp - Silence strncpy warning
2020-07-09 12:44 [PATCH] crypto: ccp - Silence strncpy warning Herbert Xu
@ 2020-07-09 18:14 ` John Allen
0 siblings, 0 replies; 2+ messages in thread
From: John Allen @ 2020-07-09 18:14 UTC (permalink / raw)
To: Herbert Xu; +Cc: Linux Crypto Mailing List, Tom Lendacky
On Thu, Jul 09, 2020 at 10:44:04PM +1000, Herbert Xu wrote:
> 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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-09 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-09 12:44 [PATCH] crypto: ccp - Silence strncpy warning Herbert Xu
2020-07-09 18:14 ` John Allen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).