s390/crypto: avoid returning garbage value
authorColin Ian King <colin.king@canonical.com>
Tue, 6 Sep 2016 07:01:31 +0000 (09:01 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 6 Sep 2016 09:00:00 +0000 (11:00 +0200)
Static analysis with cppcheck detected that ret is not initialized
and hence garbage is potentially being returned in the case where
prng_data->ppnows.reseed_counter <= prng_reseed_limit.

Thanks to Martin Schwidefsky for spotting a mistake in my original
fix.

Fixes: 0177db01adf26cf9 ("s390/crypto: simplify return code handling")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/crypto/prng.c

index 79e3a1f..9cc050f 100644 (file)
@@ -434,7 +434,7 @@ static int prng_sha512_generate(u8 *buf, size_t nbytes)
                memcpy(prng_data->prev, buf, nbytes);
        }
 
-       return ret;
+       return nbytes;
 }