From ae67f16e9b81112d8a1eadd185bc303584935fbd Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Wed, 2 Mar 2016 15:01:19 +0100 Subject: [PATCH] card-iasecc.c: fix 1 compiler warning card-iasecc.c:3206:3: error: variable 'rv' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] ...LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, "Need RSA_HASH_SHA1 or RSA_HASH_SHA256 algorithm"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/libopensc/log.h:90:36: note: expanded from macro 'LOG_TEST_RET' ...r, text) SC_TEST_RET((ctx), SC_LOG_DEBUG_NORMAL, (r), (text)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/libopensc/log.h:84:6: note: expanded from macro 'SC_TEST_RET' if (_ret < 0) { \ ^~~~~~~~ card-iasecc.c:3207:20: note: uninitialized use occurs here LOG_TEST_RET(ctx, rv, "Cannot get QSign data"); ^~ ../../src/libopensc/log.h:90:77: note: expanded from macro 'LOG_TEST_RET' ...r, text) SC_TEST_RET((ctx), SC_LOG_DEBUG_NORMAL, (r), (text)) ^ ../../src/libopensc/log.h:83:14: note: expanded from macro 'SC_TEST_RET' int _ret = (r); \ ^ card-iasecc.c:3206:3: note: remove the 'if' if its condition is always true LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, "Need RSA_... ^ ../../src/libopensc/log.h:90:36: note: expanded from macro 'LOG_TEST_RET' ^ ../../src/libopensc/log.h:84:2: note: expanded from macro 'SC_TEST_RET' if (_ret < 0) { \ ^ card-iasecc.c:3185:8: note: initialize the variable 'rv' to silence this warning int rv; ^ = 0 --- src/libopensc/card-iasecc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libopensc/card-iasecc.c b/src/libopensc/card-iasecc.c index 420f6811..d8744e52 100644 --- a/src/libopensc/card-iasecc.c +++ b/src/libopensc/card-iasecc.c @@ -3182,7 +3182,7 @@ iasecc_compute_signature_dst(struct sc_card *card, size_t offs = 0, hash_len = 0; unsigned char sbuf[SC_MAX_APDU_BUFFER_SIZE]; unsigned char rbuf[SC_MAX_APDU_BUFFER_SIZE]; - int rv; + int rv = SC_SUCCESS; LOG_FUNC_CALLED(ctx); sc_log(ctx, "iasecc_compute_signature_dst() input length %i", in_len);