public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: octeontx - Replace scnprintf with strscpy in print_ucode_info
@ 2026-02-02 17:33 Thorsten Blum
  2026-02-28  3:57 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-02-02 17:33 UTC (permalink / raw)
  To: Srujana Challa, Bharat Bhushan, Herbert Xu, David S. Miller,
	Dr. David Alan Gilbert, Giovanni Cabiddu, Thorsten Blum,
	Krzysztof Kozlowski
  Cc: linux-crypto, linux-kernel

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

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
index 9f5601c0280b..4ff28bd131d4 100644
--- a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
+++ b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
@@ -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,
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


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

* Re: [PATCH] crypto: octeontx - Replace scnprintf with strscpy in print_ucode_info
  2026-02-02 17:33 [PATCH] crypto: octeontx - Replace scnprintf with strscpy in print_ucode_info Thorsten Blum
@ 2026-02-28  3:57 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-02-28  3:57 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Srujana Challa, Bharat Bhushan, David S. Miller,
	Dr. David Alan Gilbert, Giovanni Cabiddu, Krzysztof Kozlowski,
	linux-crypto, linux-kernel

On Mon, Feb 02, 2026 at 06:33:21PM +0100, Thorsten Blum wrote:
> Replace scnprintf("%s", ...) with the faster and more direct strscpy().
> Remove the parentheses while we're at it.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 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:[~2026-02-28  3:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-02 17:33 [PATCH] crypto: octeontx - Replace scnprintf with strscpy in print_ucode_info Thorsten Blum
2026-02-28  3:57 ` Herbert Xu

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