* [PATCH][V2] s390/crypto: initialize ret to nbytes to avoid returning garbage value
@ 2016-09-06 7:25 Colin King
0 siblings, 0 replies; only message in thread
From: Colin King @ 2016-09-06 7:25 UTC (permalink / raw)
To: Herbert Xu, David S . Miller, Martin Schwidefsky, Heiko Carstens,
linux-crypto, linux-s390
Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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>
---
arch/s390/crypto/prng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index 79e3a1f..5592df9 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -412,7 +412,7 @@ static int prng_sha512_reseed(void)
static int prng_sha512_generate(u8 *buf, size_t nbytes)
{
- int ret;
+ int ret = nbytes;
/* reseed needed ? */
if (prng_data->ppnows.reseed_counter > prng_reseed_limit) {
--
2.9.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-09-06 7:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06 7:25 [PATCH][V2] s390/crypto: initialize ret to nbytes to avoid returning garbage value Colin King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).