Message ID | 20220809093048.1893025-1-burzalodowa@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xen/arm: vreg: Fix MISRA C 2012 Rule 20.7 violation | expand |
On Tue, 9 Aug 2022, Xenia Ragiadakou wrote: > 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 | 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; \ > -- > 2.34.1 >
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; \
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> --- xen/arch/arm/include/asm/vreg.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)