[XEN PATCH v2 1/4] x86/emul: add defensive code

Federico Serafini posted 4 patches 2 months, 2 weeks ago
There is a newer version of this series
[XEN PATCH v2 1/4] x86/emul: add defensive code
Posted by Federico Serafini 2 months, 2 weeks ago
Add defensive code after unreachable program points.
This also meets the requirements to deviate violations of MISRA C:2012
Rule 16.3: "An unconditional `break' statement shall terminate every
switch-clause".

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
Changes in v2:
- use goto unhandleable.
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0ea0d5e67e..6b6b8c8fe4 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6840,6 +6840,7 @@ x86_emulate(
             break;
         default:
             ASSERT_UNREACHABLE();
+            goto unhandleable;
         }
         break;
 #ifdef HAVE_AS_SSE4_2
@@ -6868,6 +6869,7 @@ x86_emulate(
 # endif
         default:
             ASSERT_UNREACHABLE();
+            goto unhandleable;
         }
         break;
 #endif
-- 
2.43.0
Re: [XEN PATCH v2 1/4] x86/emul: add defensive code
Posted by Jan Beulich 2 months, 2 weeks ago
On 07.10.2024 16:16, Federico Serafini wrote:
> Add defensive code after unreachable program points.
> This also meets the requirements to deviate violations of MISRA C:2012
> Rule 16.3: "An unconditional `break' statement shall terminate every
> switch-clause".
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Acked-by: Jan Beulich <jbeulich@suse.com>