]> Git Repo - J-linux.git/commitdiff
crypto: n2 - Set err to EINVAL if snprintf fails for hmac
authorHerbert Xu <[email protected]>
Tue, 10 Sep 2024 09:30:24 +0000 (17:30 +0800)
committerHerbert Xu <[email protected]>
Fri, 13 Sep 2024 10:26:53 +0000 (18:26 +0800)
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 <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lore.kernel.org/r/[email protected]/
Signed-off-by: Herbert Xu <[email protected]>
drivers/crypto/n2_core.c

index 251e088a53dff8b89e093c385c02e8084741e8d4..b11545cc5cb7953f19b9677bfbedc44894c72df6 100644 (file)
@@ -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;
This page took 0.077815 seconds and 4 git commands to generate.