Message ID | acb26329a980809dda100825f52b05d0cc295315.1719383180.git.federico.serafini@bugseng.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | x86: address some violations of MISRA C Rule 16.3 | expand |
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 648d6dd475..a1e28b3360 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -916,6 +916,7 @@ get_page_from_l1e( return 0; default: ASSERT_UNREACHABLE(); + return -EPERM; } } else if ( l1f & _PAGE_RW )
Add defensive return statement at the end of an unreachable default case. Other than improve safety, this meets the requirements to deviate a violation of MISRA C Rule 16.3: "An unconditional `break' statement shall terminate every switch-clause". Signed-off-by: Federico Serafini <federico.serafini@bugseng.com> --- Changes in v3: - do not return 0 (success). Al least this version returns an error code but I am not sure about which one to use. --- xen/arch/x86/mm.c | 1 + 1 file changed, 1 insertion(+)