The __div0() function never returns to its caller, causing a violation
of MISRA C Rule 2.1: "A project shall not contain unreachable code".
Add the `noreturn` attribute to fix this.
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
---
Test CI pipeline:
https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/1980129839
---
xen/arch/arm/traps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 445e7378dd..2bc3e1df04 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -172,7 +172,7 @@ void init_traps(void)
isb();
}
-void asmlinkage __div0(void)
+void asmlinkage noreturn __div0(void)
{
printk("Division by zero in hypervisor.\n");
BUG();
--
2.43.0
On 2025-08-12 17:46, Dmytro Prokopchuk1 wrote:
> The __div0() function never returns to its caller, causing a violation
> of MISRA C Rule 2.1: "A project shall not contain unreachable code".
> Add the `noreturn` attribute to fix this.
>
I was convinced that this was already upstream, as I made a patch a
while ago, but evidently I forgot to send it.
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> ---
> Test CI pipeline:
> https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/1980129839
> ---
> xen/arch/arm/traps.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 445e7378dd..2bc3e1df04 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -172,7 +172,7 @@ void init_traps(void)
> isb();
> }
>
> -void asmlinkage __div0(void)
> +void asmlinkage noreturn __div0(void)
> {
> printk("Division by zero in hypervisor.\n");
> BUG();
--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
On Tue, 12 Aug 2025, Nicola Vetrini wrote: > On 2025-08-12 17:46, Dmytro Prokopchuk1 wrote: > > The __div0() function never returns to its caller, causing a violation > > of MISRA C Rule 2.1: "A project shall not contain unreachable code". > > Add the `noreturn` attribute to fix this. > > > > I was convinced that this was already upstream, as I made a patch a while ago, > but evidently I forgot to send it. > > > Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com> > > Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
© 2016 - 2025 Red Hat, Inc.