Skip to contentSkip to conversation

xen: fix invalid assertion

PATCH Applied Paolo Bonzini 3 participants 3 messages Oct 19, 2015 – Oct 29, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: fix invalid assertion

Asserting "true" is not that useful.

Reported by Coverity.

---
 hw/xen/xen_pt_config_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/xen/xen_pt_config_init.c +2 -2
index 4a5bc11..f6969ad 100644
@@ -1937,7 +1937,7 @@ static int xen_pt_config_reg_init(XenPCIPassthroughState *s,
                 break;
         case 4: rc = xen_host_pci_get_long(&s->real_device, offset, &val);
                 break;
-        default: assert(1);
+        default: abort();
         }
         if (rc) {
             /* Serious issues when we cannot read the host values! */
@@ -1982,7 +1982,7 @@ static int xen_pt_config_reg_init(XenPCIPassthroughState *s,
                 break;
         case 4: pci_set_long(s->dev.config + offset, val);
                 break;
-        default: assert(1);
+        default: abort();
         }
         /* set register value pointer to the data. */
         reg_entry->ptr.byte = s->dev.config + offset;
Signature · 1 line
2.5.0
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Paolo Bonzini

Asserting "true" is not that useful.

Reported by Coverity.

Quoted 29 lines
 hw/xen/xen_pt_config_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/xen/xen_pt_config_init.c +2 -2
index 4a5bc11..f6969ad 100644
@@ -1937,7 +1937,7 @@ static int xen_pt_config_reg_init(XenPCIPassthroughState *s,
                 break;
         case 4: rc = xen_host_pci_get_long(&s->real_device, offset, &val);
                 break;
-        default: assert(1);
+        default: abort();
         }
         if (rc) {
             /* Serious issues when we cannot read the host values! */
@@ -1982,7 +1982,7 @@ static int xen_pt_config_reg_init(XenPCIPassthroughState *s,
                 break;
         case 4: pci_set_long(s->dev.config + offset, val);
                 break;
-        default: assert(1);
+        default: abort();
         }
         /* set register value pointer to the data. */
         reg_entry->ptr.byte = s->dev.config + offset;
Signature · 1 line
2.5.0
#2 lore raw
In reply to Paolo Bonzini

Review

Quoted 4 lines · Paolo Bonzini

Asserting "true" is not that useful.

(quoted diff) +1 -1
-        default: assert(1);
+        default: abort();

Blah :)

Applied to -trivial, thank you!

/mjt