diff --git a/crypto/api.c b/crypto/api.c index 4349c2caa23a..24227582cfcf 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -116,7 +116,7 @@ struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask) larval->alg.cra_priority = -1; larval->alg.cra_destroy = crypto_larval_destroy; - strscpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME); + strscpy(larval->alg.cra_name, name); init_completion(&larval->completion); return larval; diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index e8b6ae75f31f..d3ccb507153b 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -87,11 +88,9 @@ static int crypto_report_one(struct crypto_alg *alg, { memset(ualg, 0, sizeof(*ualg)); - strscpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); - strscpy(ualg->cru_driver_name, alg->cra_driver_name, - sizeof(ualg->cru_driver_name)); - strscpy(ualg->cru_module_name, module_name(alg->cra_module), - sizeof(ualg->cru_module_name)); + strscpy(ualg->cru_name, alg->cra_name); + strscpy(ualg->cru_driver_name, alg->cra_driver_name); + strscpy(ualg->cru_module_name, module_name(alg->cra_module)); ualg->cru_type = 0; ualg->cru_mask = 0; diff --git a/crypto/hctr2.c b/crypto/hctr2.c index ad5edf9366ac..cfc2343bcc1c 100644 --- a/crypto/hctr2.c +++ b/crypto/hctr2.c @@ -354,8 +354,7 @@ static int hctr2_create_common(struct crypto_template *tmpl, struct rtattr **tb, err = -EINVAL; if (strncmp(xctr_alg->base.cra_name, "xctr(", 5)) goto err_free_inst; - len = strscpy(blockcipher_name, xctr_alg->base.cra_name + 5, - sizeof(blockcipher_name)); + len = strscpy(blockcipher_name, xctr_alg->base.cra_name + 5); if (len < 1) goto err_free_inst; if (blockcipher_name[len - 1] != ')') diff --git a/crypto/lrw.c b/crypto/lrw.c index aa31ab03a597..e306e85d7ced 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c @@ -359,7 +359,7 @@ static int lrw_create(struct crypto_template *tmpl, struct rtattr **tb) if (!memcmp(cipher_name, "ecb(", 4)) { int len; - len = strscpy(ecb_name, cipher_name + 4, sizeof(ecb_name)); + len = strscpy(ecb_name, cipher_name + 4); if (len < 2) goto err_free_inst; diff --git a/crypto/lskcipher.c b/crypto/lskcipher.c index e4328df6e26c..d7ec215e2b3a 100644 --- a/crypto/lskcipher.c +++ b/crypto/lskcipher.c @@ -528,8 +528,7 @@ struct lskcipher_instance *lskcipher_alloc_instance_simple( int len; err = -EINVAL; - len = strscpy(ecb_name, &cipher_alg->co.base.cra_name[4], - sizeof(ecb_name)); + len = strscpy(ecb_name, &cipher_alg->co.base.cra_name[4]); if (len < 2) goto err_free_inst; diff --git a/crypto/xts.c b/crypto/xts.c index ad97c8091582..1dc948745444 100644 --- a/crypto/xts.c +++ b/crypto/xts.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -400,7 +401,7 @@ static int xts_create(struct crypto_template *tmpl, struct rtattr **tb) if (!memcmp(cipher_name, "ecb(", 4)) { int len; - len = strscpy(name, cipher_name + 4, sizeof(name)); + len = strscpy(name, cipher_name + 4); if (len < 2) goto err_free_inst;