Skip to content

Commit d633730

Browse files
tobluxherbertx
authored andcommitted
crypto: octeontx2 - Replace deprecated strcpy in cpt_ucode_load_fw
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: KSPP#88 Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent b6410c1 commit d633730

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <linux/ctype.h>
55
#include <linux/firmware.h>
6+
#include <linux/string.h>
67
#include <linux/string_choices.h>
78
#include "otx2_cptpf_ucode.h"
89
#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,
458459
u16 rid)
459460
{
460461
char filename[OTX2_CPT_NAME_LENGTH];
461-
char eng_type[8] = {0};
462+
char eng_type[8];
462463
int ret, e, i;
463464

464465
INIT_LIST_HEAD(&fw_info->ucodes);
465466

466467
for (e = 1; e < OTX2_CPT_MAX_ENG_TYPES; e++) {
467-
strcpy(eng_type, get_eng_type_str(e));
468+
strscpy(eng_type, get_eng_type_str(e));
468469
for (i = 0; i < strlen(eng_type); i++)
469470
eng_type[i] = tolower(eng_type[i]);
470471

0 commit comments

Comments
 (0)