diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2024-09-10 17:30:24 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2024-09-13 18:26:53 +0800 |
commit | ce212d2afca47acd366a2e74c76fe82c31f785ab (patch) | |
tree | 911dfe5f1e299e9ba94d537ea8918d000e901a63 /drivers/crypto | |
parent | e2b19a4840650ba1d679562d4a8959f3f6070064 (diff) | |
download | linux-ce212d2afca47acd366a2e74c76fe82c31f785ab.tar.gz linux-ce212d2afca47acd366a2e74c76fe82c31f785ab.tar.bz2 linux-ce212d2afca47acd366a2e74c76fe82c31f785ab.zip |
crypto: n2 - Set err to EINVAL if snprintf fails for hmac
Return EINVAL if the snprintf check fails when constructing the
algorithm names.
Fixes: 8c20982caca4 ("crypto: n2 - Silence gcc format-truncation false positive warnings")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202409090726.TP0WfY7p-lkp@intel.com/
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/n2_core.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c index 251e088a53df..b11545cc5cb7 100644 --- a/drivers/crypto/n2_core.c +++ b/drivers/crypto/n2_core.c @@ -1353,6 +1353,7 @@ static int __n2_register_one_hmac(struct n2_ahash_alg *n2ahash) ahash->setkey = n2_hmac_async_setkey; base = &ahash->halg.base; + err = -EINVAL; if (snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)", p->child_alg) >= CRYPTO_MAX_ALG_NAME) goto out_free_p; |