xen/arm: vreg: Fix MISRA C 2012 Rule 20.7 violation
authorXenia Ragiadakou <burzalodowa@gmail.com>
Tue, 9 Aug 2022 09:30:48 +0000 (12:30 +0300)
committerStefano Stabellini <stefano.stabellini@amd.com>
Wed, 10 Aug 2022 20:35:31 +0000 (13:35 -0700)
In VREG_REG_HELPERS(), the macro parameter 'offmask' is used as expression and
therefore it is good to be enclosed in parentheses to prevent against
unintended expansions.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/include/asm/vreg.h

index fa2f4cdb1782fb32b9a7b72891aac6bd34c87dba..f26a70d024e2d1f933ea66793ea6e42f81c7a8cf 100644 (file)
@@ -141,7 +141,7 @@ static inline void vreg_reg_clearbits(unsigned long *reg, register_t bits,
 static inline register_t vreg_reg##sz##_extract(uint##sz##_t reg,       \
                                                 const mmio_info_t *info)\
 {                                                                       \
-    return vreg_reg_extract(reg, info->gpa & offmask,                   \
+    return vreg_reg_extract(reg, info->gpa & (offmask),                 \
                             info->dabt.size);                           \
 }                                                                       \
                                                                         \
@@ -151,7 +151,7 @@ static inline void vreg_reg##sz##_update(uint##sz##_t *reg,             \
 {                                                                       \
     unsigned long tmp = *reg;                                           \
                                                                         \
-    vreg_reg_update(&tmp, val, info->gpa & offmask,                     \
+    vreg_reg_update(&tmp, val, info->gpa & (offmask),                   \
                     info->dabt.size);                                   \
                                                                         \
     *reg = tmp;                                                         \
@@ -163,7 +163,7 @@ static inline void vreg_reg##sz##_setbits(uint##sz##_t *reg,            \
 {                                                                       \
     unsigned long tmp = *reg;                                           \
                                                                         \
-    vreg_reg_setbits(&tmp, bits, info->gpa & offmask,                   \
+    vreg_reg_setbits(&tmp, bits, info->gpa & (offmask),                 \
                      info->dabt.size);                                  \
                                                                         \
     *reg = tmp;                                                         \
@@ -175,7 +175,7 @@ static inline void vreg_reg##sz##_clearbits(uint##sz##_t *reg,          \
 {                                                                       \
     unsigned long tmp = *reg;                                           \
                                                                         \
-    vreg_reg_clearbits(&tmp, bits, info->gpa & offmask,                 \
+    vreg_reg_clearbits(&tmp, bits, info->gpa & (offmask),               \
                        info->dabt.size);                                \
                                                                         \
     *reg = tmp;                                                         \