]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
xen/xsm: add parentheses to comply with MISRA C Rule 20.7
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Mon, 25 Mar 2024 09:49:19 +0000 (10:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 25 Mar 2024 09:49:19 +0000 (10:49 +0100)
MISRA C Rule 20.7 states: "Expressions resulting from the expansion
of macro parameters shall be enclosed in parentheses". Therefore, some
macro definitions should gain additional parentheses to ensure that all
current and future users will be safe with respect to expansions that
can possibly alter the semantics of the passed-in macro parameter.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
xen/include/xsm/dummy.h

index 8671af1ba4d39fc7141bc7996f61cb07bb15916f..88039fdd227cf54becdab8b075aa3bb77d76f389 100644 (file)
@@ -58,7 +58,7 @@ void __xsm_action_mismatch_detected(void);
 
 #define XSM_DEFAULT_ARG /* */
 #define XSM_DEFAULT_VOID void
-#define XSM_ASSERT_ACTION(def) xsm_default_t action = def; (void)action
+#define XSM_ASSERT_ACTION(def) xsm_default_t action = (def); (void)action
 
 #else /* CONFIG_XSM */
 
@@ -71,7 +71,7 @@ void __xsm_action_mismatch_detected(void);
 #define XSM_INLINE always_inline
 #define XSM_DEFAULT_ARG xsm_default_t action,
 #define XSM_DEFAULT_VOID xsm_default_t action
-#define XSM_ASSERT_ACTION(def) LINKER_BUG_ON(def != action)
+#define XSM_ASSERT_ACTION(def) LINKER_BUG_ON((def) != action)
 
 #endif /* CONFIG_XSM */