From 55361748d7748c6f218978168042dbabbfd1c317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 24 Aug 2018 21:38:06 +0200 Subject: [PATCH 1/2] Initialize all tvresults to ISC_R_UNSET --- lib/dns/zoneverify.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dns/zoneverify.c b/lib/dns/zoneverify.c index c89355d247..a348d1f554 100644 --- a/lib/dns/zoneverify.c +++ b/lib/dns/zoneverify.c @@ -746,7 +746,7 @@ verifynsec3(const vctx_t *vctx, const dns_name_t *name, dns_rdata_nsec3param_t nsec3param; dns_fixedname_t fixed; dns_name_t *hashname; - isc_result_t result, tvresult; + isc_result_t result, tvresult = ISC_R_UNSET; dns_dbnode_t *node = NULL; unsigned char rawhash[NSEC3_MAX_HASH_LENGTH]; size_t rhsize = sizeof(rawhash); @@ -975,7 +975,7 @@ verifynode(vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node, unsigned char types[8192]; unsigned int maxtype = 0; dns_rdataset_t rdataset; dns_rdatasetiter_t *rdsiter = NULL; - isc_result_t result, tvresult; + isc_result_t result, tvresult = ISC_R_UNSET; REQUIRE(vresult != NULL || (nsecset == NULL && nsec3paramset == NULL)); @@ -1298,7 +1298,7 @@ verifyemptynodes(const vctx_t *vctx, const dns_name_t *name, int order; unsigned int labels, nlabels, i; dns_name_t suffix; - isc_result_t result, tvresult; + isc_result_t result, tvresult = ISC_R_UNSET; *vresult = ISC_R_SUCCESS; @@ -1744,7 +1744,7 @@ verify_nodes(vctx_t *vctx, isc_result_t *vresult) { dns_dbnode_t *node = NULL, *nextnode; dns_dbiterator_t *dbiter = NULL; bool done = false; - isc_result_t tvresult; + isc_result_t tvresult = ISC_R_UNSET; isc_result_t result; name = dns_fixedname_initname(&fname); From de41f0beea1f962ddfd9e3f019d0a4637be230e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 24 Aug 2018 21:38:39 +0200 Subject: [PATCH 2/2] Cleanup couple of set-but-unused errors from Coverity --- lib/dns/rdataset.c | 8 ++------ lib/isc/pk11.c | 7 +++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c index 4145b11a24..d6dcc91b48 100644 --- a/lib/dns/rdataset.c +++ b/lib/dns/rdataset.c @@ -312,8 +312,7 @@ towire_compare(const void *av, const void *bv) { static inline void swap_rdata(dns_rdata_t *in, unsigned int a, unsigned int b) { - dns_rdata_t rdata = DNS_RDATA_INIT; - rdata = in[a]; + dns_rdata_t rdata = in[a]; in[a] = in[b]; in[b] = rdata; } @@ -403,7 +402,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, if ((shuffle || sort)) { uint32_t seed = 0; - unsigned int j; + unsigned int j = 0; /* * First we get handles to all of the rdata. @@ -423,15 +422,12 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, if (ISC_LIKELY(want_random)) { seed = isc_random32(); - j = 0; } if (ISC_UNLIKELY(want_cyclic) && (rdataset->count != DNS_RDATASET_COUNT_UNDEFINED)) { j = rdataset->count % count; - } else { /* Otherwise, just start from beginning */ - j = 0; } for (i = 0; i < count; i++) { diff --git a/lib/isc/pk11.c b/lib/isc/pk11.c index 4624e94d47..13b4d75eb0 100644 --- a/lib/isc/pk11.c +++ b/lib/isc/pk11.c @@ -445,10 +445,11 @@ token_login(pk11_session_t *sp) { (CK_UTF8CHAR_PTR) token->pin, (CK_ULONG) strlen(token->pin)); if (rv != CKR_OK) { - ret = ISC_R_NOPERM; #if PK11_NO_LOGERR pk11_error_fatalcheck(__FILE__, __LINE__, "pkcs_C_Login", rv); +#else + ret = ISC_R_NOPERM; #endif } else token->logged = true; @@ -766,14 +767,13 @@ pk11_attribute_bytype(const pk11_object_t *obj, CK_ATTRIBUTE_TYPE type) { static char * percent_decode(char *x, size_t *len) { char *p, *c; - unsigned char v; + unsigned char v = 0; INSIST(len != NULL); for (p = c = x; p[0] != '\0'; p++, c++) { switch (p[0]) { case '%': - v = 0; switch (p[1]) { case '0': case '1': @@ -1112,7 +1112,6 @@ pk11_dump_tokens(void) { if (token->operations & (1 << OP_ECDSA)) { if (!first) printf(","); - first = false; printf("EC"); } printf(")\n");