Subject: | DEADCODE in lib/dns/rrl.c:1168 |
Date: | Fri, 22 May 2015 12:49:40 +0200 |
To: | bind9-bugs@isc.org |
From: | "Tomas Hozza" <thozza@redhat.com> |
Hi.
Coverity found a deadcode in lib/dns/rrl.c
1. bind-9.9.4/lib/dns/rrl.c:1162: cond_at_least: Condition "rrl_all_result !=
DNS_RRL_RESULT_OK", taking true branch. Now the value of "rrl_all_result" is at
least 1.
2. bind-9.9.4/lib/dns/rrl.c:1166: assignment: Assigning: "rrl_result" =
"rrl_all_result".
3. bind-9.9.4/lib/dns/rrl.c:1167: at_least: At condition "rrl_result ==
DNS_RRL_RESULT_OK", the value of "rrl_result" must be at least 1.
4. bind-9.9.4/lib/dns/rrl.c:1162: cond_cannot_single: Condition "rrl_all_result
!= DNS_RRL_RESULT_OK", taking true branch. Now the value of "rrl_all_result"
cannot be equal to 0.
5. bind-9.9.4/lib/dns/rrl.c:1167: cannot_single: At condition "rrl_result ==
DNS_RRL_RESULT_OK", the value of "rrl_result" cannot be equal to 0.
6. bind-9.9.4/lib/dns/rrl.c:1167: dead_error_condition: The condition
"rrl_result == DNS_RRL_RESULT_OK" cannot be true.
7. bind-9.9.4/lib/dns/rrl.c:1168: dead_error_line: Execution cannot reach this
statement: "level = 4;".
# 1166| rrl_result = rrl_all_result;
# 1167| if (rrl_result == DNS_RRL_RESULT_OK)
# 1168|-> level = DNS_RRL_LOG_DEBUG2;
# 1169| else
# 1170| level = DNS_RRL_LOG_DEBUG1;
https://source.isc.org/cgi-bin/gitweb.cgi?p=bind9.git;a=blob;f=lib/dns/rrl.c;h=766d007514c01f85e5c43c0c40610783aeba1b41;hb=HEAD#l1163
There is a check on line 1163, assignment on line 1167,
therefore the condition "if (rrl_result == DNS_RRL_RESULT_OK)" on line
1168 can never be TRUE.
I'm not sure what was the intention here.
Regards,
--
Tomas Hozza
Software Engineer - EMEA ENG Developer Experience
PGP: 1D9F3C2D
Red Hat Inc. http://cz.redhat.com