Message ID | 6cb601ef46a699f95eda0e10f4f9d15f1af4353e.1711118582.git.nicola.vetrini@bugseng.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | address some violations of MISRA C Rule 20.7 | expand |
On 3/22/24 12:01, Nicola Vetrini wrote: > 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> > --- > xen/include/xsm/dummy.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h > index 8671af1ba4d3..88039fdd227c 100644 > --- a/xen/include/xsm/dummy.h > +++ b/xen/include/xsm/dummy.h > @@ -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 */ > Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 8671af1ba4d3..88039fdd227c 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -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 */