[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/arm: vcpreg: address violation of MISRA C Rule 2.1
commit 725acf8e4d406bf0a24441ac1738eb6f4f6ef0c3 Author: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> AuthorDate: Mon Dec 18 11:17:32 2023 +0100 Commit: Stefano Stabellini <stefano.stabellini@xxxxxxx> CommitDate: Tue Dec 19 17:14:02 2023 -0800 xen/arm: vcpreg: address violation of MISRA C Rule 2.1 There is no path that reaches the call to 'advance_pc', thus violating MISRA C Rule 2.1. A call to ASSERT_UNREACHABLE() is added after the switch, despite this being useful to detect errors only in debug builds; if that marker is ever reached, a domain crash is triggered, as a defensive coding measure. No functional change. Signed-off-by: Julien Grall <julien@xxxxxxx> Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> --- xen/arch/arm/vcpreg.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/vcpreg.c b/xen/arch/arm/vcpreg.c index 39aeda9dab..a2d0500704 100644 --- a/xen/arch/arm/vcpreg.c +++ b/xen/arch/arm/vcpreg.c @@ -707,8 +707,14 @@ void do_cp10(struct cpu_user_regs *regs, const union hsr hsr) inject_undef_exception(regs, hsr); return; } - - advance_pc(regs, hsr); + + /* + * All the cases in the switch should return. If this is not the + * case, then something went wrong and it is best to crash the + * domain. + */ + ASSERT_UNREACHABLE(); + domain_crash(current->domain); } void do_cp(struct cpu_user_regs *regs, const union hsr hsr) -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |