Skip to contentSkip to conversation

xen/x86: Identify legitimate fallthrough cases

PATCH In review Andrew Cooper 2 participants 2 messages Jul 18, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/x86: Identify legitimate fallthrough cases

The case in arch_set_info_guest() is a legitimate fallthrough. Mark it as such.

The cases in vlapic_accept_irq() are a terminal error path, but Coverity fails to spot this. Reorder the comment to the end.

No functional change, but fixes two MISSING_BREAK Coverity defects.

---
CC: Jan Beulich <[email protected]>
CC: Xen Coverity <[email protected]>

---
 xen/arch/x86/domain.c     | 1 +
 xen/arch/x86/hvm/vlapic.c | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/domain.c +1 -0
index c8c7e2d..1133ea2 100644
@@ -1223,6 +1223,7 @@ int arch_set_info_guest(
                 {
                 case -EINTR:
                     rc = -ERESTART;
+                    /* Fallthrough */
                 case -ERESTART:
                     v->arch.old_guest_table =
                         pagetable_get_page(v->arch.guest_table);
xen/arch/x86/hvm/vlapic.c +1 -2
index e2f4450..ba9b293 100644
@@ -374,8 +374,7 @@ static void vlapic_accept_irq(struct vcpu *v, uint32_t icr_low)
 
     case APIC_DM_INIT:
     case APIC_DM_STARTUP:
-        /* Handled in vlapic_ipi(). */
-        BUG();
+        BUG(); /* Handled in vlapic_ipi(). */
 
     default:
         gdprintk(XENLOG_ERR, "TODO: unsupported delivery mode in ICR %x\n",
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Andrew Cooper

The case in arch_set_info_guest() is a legitimate fallthrough. Mark it as such.

The cases in vlapic_accept_irq() are a terminal error path, but Coverity fails to spot this. Reorder the comment to the end.

No functional change, but fixes two MISSING_BREAK Coverity defects.

Given the simplicity of the patch, I think this could be checked in with one of THE REST's review while Jan is away.

-George

Quoted 26 lines

---
CC: Jan Beulich <[email protected]>
CC: Xen Coverity <[email protected]>

---
 xen/arch/x86/domain.c     | 1 +
 xen/arch/x86/hvm/vlapic.c | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/domain.c +1 -0
index c8c7e2d..1133ea2 100644
@@ -1223,6 +1223,7 @@ int arch_set_info_guest(
                 {
                 case -EINTR:
                     rc = -ERESTART;
+                    /* Fallthrough */
                 case -ERESTART:
                     v->arch.old_guest_table =
                         pagetable_get_page(v->arch.guest_table);
xen/arch/x86/hvm/vlapic.c +0 -0
index e2f4450..ba9b293 100644

xen/arch/x86/hvm/vlapic.c static void vlapic_accept_irq(struct vcpu *v, uint32_t icr_low) · line 380

Quoted 9 lines
xen/arch/x86/hvm/vlapic.c +1 -2
@@ -374,8 +374,7 @@ static void vlapic_accept_irq(struct vcpu *v, uint32_t icr_low)
 
     case APIC_DM_INIT:
     case APIC_DM_STARTUP:
-        /* Handled in vlapic_ipi(). */
-        BUG();
+        BUG(); /* Handled in vlapic_ipi(). */
 
     default:
         gdprintk(XENLOG_ERR, "TODO: unsupported delivery mode in ICR %x\n",

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel