[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/arm: vreg: Fix MISRA C 2012 Rule 20.7 violation



commit d7c3c845c44e097d6c980001e108da0bb84ed16f
Author:     Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
AuthorDate: Tue Aug 9 12:30:48 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Wed Aug 10 13:35:31 2022 -0700

    xen/arm: vreg: Fix MISRA C 2012 Rule 20.7 violation
    
    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@xxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/include/asm/vreg.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/include/asm/vreg.h b/xen/arch/arm/include/asm/vreg.h
index fa2f4cdb17..f26a70d024 100644
--- a/xen/arch/arm/include/asm/vreg.h
+++ b/xen/arch/arm/include/asm/vreg.h
@@ -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;                                                         \
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.