mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: octeontx2 - Replace deprecated strcpy in cpt_ucode_load_fw
@ 2025-11-01 14:04 Thorsten Blum
  2025-11-06  7:23 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-11-01 14:04 UTC (permalink / raw)
  To: Srujana Challa, Bharat Bhushan, Herbert Xu, David S. Miller,
	Sunil Kovvuri Goutham, Subbaraya Sundeep, Jakub Kicinski,
	Dr. David Alan Gilbert, Krzysztof Kozlowski, Thorsten Blum
  Cc: Sai Krishna, linux-crypto, linux-kernel

strcpy() is deprecated; use the safer strscpy() instead.

The destination buffer is only zero-initialized for the first iteration
and since strscpy() guarantees its NUL termination anyway, remove
zero-initializing 'eng_type'.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
index ebdf4efa09d4..b5cc5401f704 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
@@ -3,6 +3,7 @@
 
 #include <linux/ctype.h>
 #include <linux/firmware.h>
+#include <linux/string.h>
 #include <linux/string_choices.h>
 #include "otx2_cptpf_ucode.h"
 #include "otx2_cpt_common.h"
@@ -458,13 +459,13 @@ static int cpt_ucode_load_fw(struct pci_dev *pdev, struct fw_info_t *fw_info,
 			     u16 rid)
 {
 	char filename[OTX2_CPT_NAME_LENGTH];
-	char eng_type[8] = {0};
+	char eng_type[8];
 	int ret, e, i;
 
 	INIT_LIST_HEAD(&fw_info->ucodes);
 
 	for (e = 1; e < OTX2_CPT_MAX_ENG_TYPES; e++) {
-		strcpy(eng_type, get_eng_type_str(e));
+		strscpy(eng_type, get_eng_type_str(e));
 		for (i = 0; i < strlen(eng_type); i++)
 			eng_type[i] = tolower(eng_type[i]);
 
-- 
2.51.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: octeontx2 - Replace deprecated strcpy in cpt_ucode_load_fw
  2025-11-01 14:04 [PATCH] crypto: octeontx2 - Replace deprecated strcpy in cpt_ucode_load_fw Thorsten Blum
@ 2025-11-06  7:23 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2025-11-06  7:23 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Srujana Challa, Bharat Bhushan, David S. Miller,
	Sunil Kovvuri Goutham, Subbaraya Sundeep, Jakub Kicinski,
	Dr. David Alan Gilbert, Krzysztof Kozlowski, Sai Krishna,
	linux-crypto, linux-kernel

On Sat, Nov 01, 2025 at 03:04:42PM +0100, Thorsten Blum wrote:
> strcpy() is deprecated; use the safer strscpy() instead.
> 
> The destination buffer is only zero-initialized for the first iteration
> and since strscpy() guarantees its NUL termination anyway, remove
> zero-initializing 'eng_type'.
> 
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
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	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-06  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-01 14:04 [PATCH] crypto: octeontx2 - Replace deprecated strcpy in cpt_ucode_load_fw Thorsten Blum
2025-11-06  7:23 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®