]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: drbg - kill useless variable in drbg_fips_continuous_test()
authorSergey Shtylyov <s.shtylyov@omp.ru>
Wed, 17 Dec 2025 20:21:43 +0000 (23:21 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 29 Dec 2025 00:48:35 +0000 (08:48 +0800)
In drbg_fips_continuous_test(), not only the initializer of the ret local
variable is useless, the variable itself does not seem needed as it only
stores the result of memcmp() until it's checked on the next line -- get
rid of the variable...

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/drbg.c

index 1d433dae9955793c5420f635f872e36fb0c494d6..ab7da601a87fa1762a61a86b6d76c327c6ca7542 100644 (file)
@@ -234,7 +234,6 @@ static int drbg_fips_continuous_test(struct drbg_state *drbg,
                                     const unsigned char *entropy)
 {
        unsigned short entropylen = drbg_sec_strength(drbg->core->flags);
-       int ret = 0;
 
        if (!IS_ENABLED(CONFIG_CRYPTO_FIPS))
                return 0;
@@ -253,8 +252,7 @@ static int drbg_fips_continuous_test(struct drbg_state *drbg,
                /* priming: another round is needed */
                return -EAGAIN;
        }
-       ret = memcmp(drbg->prev, entropy, entropylen);
-       if (!ret)
+       if (!memcmp(drbg->prev, entropy, entropylen))
                panic("DRBG continuous self test failed\n");
        memcpy(drbg->prev, entropy, entropylen);