Avoid uninitialized variable warning in entropy_gather_internal

The variable ret was always initialized in entropy_gather_internal,
but `gcc -Werror=maybe-uninitialized` rightfully complained that it
was unable to determine this statically. Therefore, tweak the
problematic case (ctx->source_count == 0) to not use ret in that case.
This commit is contained in:
Gilles Peskine 2017-11-24 18:55:19 +01:00
parent 3d98b97442
commit b662cc1f52

View File

@ -196,13 +196,11 @@ int entropy_update_manual( entropy_context *ctx,
*/
static int entropy_gather_internal( entropy_context *ctx )
{
int ret, i;
int ret = POLARSSL_ERR_ENTROPY_NO_SOURCES_DEFINED;
int i;
unsigned char buf[ENTROPY_MAX_GATHER];
size_t olen;
if( ctx->source_count == 0 )
return( POLARSSL_ERR_ENTROPY_NO_SOURCES_DEFINED );
/*
* Run through our entropy sources
*/