Skip to contentSkip to conversation

crypto: octeontx - Replace scnprintf with strscpy in print_ucode_info

PATCH In review Thorsten Blum 2 participants 2 messages Feb 2 – Feb 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: octeontx - Replace scnprintf with strscpy in print_ucode_info

Replace scnprintf("%s", ...) with the faster and more direct strscpy(). Remove the parentheses while we're at it.

---
 drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c +4 -4
index 9f5601c0280b..4ff28bd131d4 100644
@@ -10,6 +10,7 @@
 
 #include <linux/ctype.h>
 #include <linux/firmware.h>
+#include <linux/string.h>
 #include <linux/string_choices.h>
 #include "otx_cpt_common.h"
 #include "otx_cptpf_ucode.h"
@@ -509,13 +510,12 @@ EXPORT_SYMBOL_GPL(otx_cpt_uc_supports_eng_type);
 static void print_ucode_info(struct otx_cpt_eng_grp_info *eng_grp,
 			     char *buf, int size)
 {
-	if (eng_grp->mirror.is_ena) {
+	if (eng_grp->mirror.is_ena)
 		scnprintf(buf, size, "%s (shared with engine_group%d)",
 			  eng_grp->g->grp[eng_grp->mirror.idx].ucode[0].ver_str,
 			  eng_grp->mirror.idx);
-	} else {
-		scnprintf(buf, size, "%s", eng_grp->ucode[0].ver_str);
-	}
+	else
+		strscpy(buf, eng_grp->ucode[0].ver_str, size);
 }
 
 static void print_engs_info(struct otx_cpt_eng_grp_info *eng_grp,
Signature · 2 lines
Thorsten Blum <[email protected]>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4
maintainer
#1 lore raw
Quoted 7 lines · Thorsten Blum

Replace scnprintf("%s", ...) with the faster and more direct strscpy(). Remove the parentheses while we're at it.

---
 drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt