Skip to content

Commit

Permalink
x86/emul: address violations of MISRA C Rule 16.3
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Andrew Cooper <[email protected]>
  • Loading branch information
FedericoSerafini authored and andyhhp committed Oct 22, 2024
1 parent 79560b6 commit 70262d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xen/arch/x86/x86_emulate/fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -296,6 +297,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
default:
generate_exception(X86_EXC_UD);
}
break;
}
break;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions xen/arch/x86/x86_emulate/x86_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -8310,6 +8310,7 @@ x86_emulate(
}
if ( rc != 0 )
goto done;
break;
default:
break;
}
Expand Down

0 comments on commit 70262d5

Please sign in to comment.