Mailing List Archive

[xen staging] xen/xsm: address violation of MISRA C Rule 16.2
commit 2145512e212f2967a1c93f0845692b8e0714d24b
Author: Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Fri Apr 5 11:14:35 2024 +0200
Commit: Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 11 13:23:08 2024 +0100

xen/xsm: address violation of MISRA C Rule 16.2

Refactor the switch so that a violation of
MISRA C Rule 16.2 is resolved (A switch label shall only be used
when the most closely-enclosing compound statement is the body of
a switch statement).
Note that the switch clause ending with the pseudo
keyword "fallthrough" is an allowed exception to Rule 16.3.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
xen/include/xsm/dummy.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 88039fdd22..00d2cbebf2 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -83,17 +83,17 @@ static always_inline int xsm_default_action(
return 0;
case XSM_TARGET:
if ( evaluate_nospec(src == target) )
- {
return 0;
+ fallthrough;
case XSM_XS_PRIV:
- if ( evaluate_nospec(is_xenstore_domain(src)) )
- return 0;
- }
- /* fall through */
+ if ( action == XSM_XS_PRIV &&
+ evaluate_nospec(is_xenstore_domain(src)) )
+ return 0;
+ fallthrough;
case XSM_DM_PRIV:
if ( target && evaluate_nospec(src->target == target) )
return 0;
- /* fall through */
+ fallthrough;
case XSM_PRIV:
if ( is_control_domain(src) )
return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging