]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: qce - Replace snprintf("%s") with strscpy
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 23 Feb 2026 15:57:55 +0000 (16:57 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 7 Mar 2026 05:12:20 +0000 (14:12 +0900)
Replace snprintf("%s", ...) with the faster and more direct strscpy().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qce/aead.c
drivers/crypto/qce/sha.c
drivers/crypto/qce/skcipher.c

index 846e1d42775d12f8799be846884f804b41358fcc..1b487df45f367912ef5af45f5657a28c53bd6e73 100644 (file)
@@ -5,6 +5,7 @@
  */
 #include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
+#include <linux/string.h>
 #include <crypto/gcm.h>
 #include <crypto/authenc.h>
 #include <crypto/internal/aead.h>
@@ -768,9 +769,8 @@ static int qce_aead_register_one(const struct qce_aead_def *def, struct qce_devi
 
        alg = &tmpl->alg.aead;
 
-       snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
-       snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
-                def->drv_name);
+       strscpy(alg->base.cra_name, def->name);
+       strscpy(alg->base.cra_driver_name, def->drv_name);
 
        alg->base.cra_blocksize         = def->blocksize;
        alg->chunksize                  = def->chunksize;
index 402e4e64347dc30d512b4ffa991ec3d2841fc3fd..1b37121cbcdcb70ea02cc8b9cbbd6f03abb79851 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
+#include <linux/string.h>
 #include <crypto/internal/hash.h>
 
 #include "common.h"
@@ -489,9 +490,8 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def,
        base->cra_module = THIS_MODULE;
        base->cra_init = qce_ahash_cra_init;
 
-       snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
-       snprintf(base->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
-                def->drv_name);
+       strscpy(base->cra_name, def->name);
+       strscpy(base->cra_driver_name, def->drv_name);
 
        INIT_LIST_HEAD(&tmpl->entry);
        tmpl->crypto_alg_type = CRYPTO_ALG_TYPE_AHASH;
index 4ad3a170201014e82ef537708df1f2854eb0d417..db0b648a56eb1adb2e50285468112d051649aa9e 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
 #include <linux/moduleparam.h>
+#include <linux/string.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <crypto/aes.h>
@@ -446,9 +447,8 @@ static int qce_skcipher_register_one(const struct qce_skcipher_def *def,
 
        alg = &tmpl->alg.skcipher;
 
-       snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
-       snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
-                def->drv_name);
+       strscpy(alg->base.cra_name, def->name);
+       strscpy(alg->base.cra_driver_name, def->drv_name);
 
        alg->base.cra_blocksize         = def->blocksize;
        alg->chunksize                  = def->chunksize;