Skip to content

Commit ce212d2

Browse files
committed
crypto: n2 - Set err to EINVAL if snprintf fails for hmac
Return EINVAL if the snprintf check fails when constructing the algorithm names. Fixes: 8c20982 ("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>
1 parent e2b19a4 commit ce212d2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/crypto/n2_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,7 @@ static int __n2_register_one_hmac(struct n2_ahash_alg *n2ahash)
13531353
ahash->setkey = n2_hmac_async_setkey;
13541354

13551355
base = &ahash->halg.base;
1356+
err = -EINVAL;
13561357
if (snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)",
13571358
p->child_alg) >= CRYPTO_MAX_ALG_NAME)
13581359
goto out_free_p;

0 commit comments

Comments
 (0)