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>
*/
#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>
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;
#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"
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;
#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>
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;