(1) Event assignment:
Assigning: "h" = "&hypervisor_list[0]".
(2) Event notnull:
At condition "h != NULL", the value of "h" cannot be NULL.
(3) Event dead_error_condition:
The condition "h != NULL" must be true.
75 for (h = &hypervisor_list[0]; h != NULL; h++) {
76 if (strncasecmp(hypervisor, h->name, strlen(h->name)) == 0)
{
77 return h->enabled;
78 }
79 }
80
(4) Event dead_error_line:
Execution cannot reach this statement "return false;".
Resolve by making proper endloop comparison of "h->name != NULL"
---
libxkutil/misc_util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c
index 00eb4b1..819cb71 100644
--- a/libxkutil/misc_util.c
+++ b/libxkutil/misc_util.c
@@ -72,7 +72,7 @@ static bool get_hypervisor_enabled(const char *hypervisor)
{
hypervisor_status_t *h;
- for (h = &hypervisor_list[0]; h != NULL; h++) {
+ for (h = &hypervisor_list[0]; h->name != NULL; h++) {
if (strncasecmp(hypervisor, h->name, strlen(h->name)) == 0) {
return h->enabled;
}
@@ -85,7 +85,7 @@ static void set_hypervisor_disabled(const char *hypervisor)
{
hypervisor_status_t *h;
- for (h = &hypervisor_list[0]; h != NULL; h++) {
+ for (h = &hypervisor_list[0]; h->name != NULL; h++) {
if (strncasecmp(hypervisor, h->name, strlen(h->name)) == 0) {
CU_DEBUG("Setting '%s' hypervisor as DISABLED",
h->name);
h->enabled = false;
--
1.8.1.4