]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
x86/emul: address violations of MISRA C Rule 16.3
authorFederico Serafini <federico.serafini@bugseng.com>
Mon, 21 Oct 2024 09:55:10 +0000 (11:55 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 22 Oct 2024 15:49:30 +0000 (16:49 +0100)
Add missing break statements to address violations of MISRA C:2012
Rule 16.3 (An unconditional `break' statement shall terminate
every switch-clause).

Make explicit unreachability of a program point with
ASSERT_UNREACHABLE() and add defensive code.

No functional change.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_emulate/fpu.c
xen/arch/x86/x86_emulate/x86_emulate.c

index 480d87965705c7cc1e6463f3a27a8ab400229553..54c8621421c609cfcda53ad0d223b743f2c6017d 100644 (file)
@@ -218,6 +218,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
              */
             if ( dst->type == OP_MEM && !s->fpu_ctrl && !fpu_check_write() )
                 dst->type = OP_NONE;
+            break;
         }
         break;
 
@@ -296,6 +297,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
             default:
                 generate_exception(X86_EXC_UD);
             }
+            break;
         }
         break;
 
@@ -386,6 +388,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
              */
             if ( dst->type == OP_MEM && !s->fpu_ctrl && !fpu_check_write() )
                 dst->type = OP_NONE;
+            break;
         }
         break;
 
@@ -457,6 +460,8 @@ int x86emul_fpu(struct x86_emulate_state *s,
             case 7: /* fistp m64i */
                 goto fpu_memdst64;
             }
+            ASSERT_UNREACHABLE();
+            return X86EMUL_UNHANDLEABLE;
         }
         break;
 
index 6b6b8c8fe4ae9b4ce057693d5c836ac40a83e97c..30674ec3018ab54b1665d7611410c608c8a48ea9 100644 (file)
@@ -8310,6 +8310,7 @@ x86_emulate(
         }
         if ( rc != 0 )
             goto done;
+        break;
     default:
         break;
     }