From: Xenia Ragiadakou Date: Wed, 24 Aug 2022 12:23:00 +0000 (+0200) Subject: arm/processor: fix MISRA C 2012 Rule 20.7 violations X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1d5b8c434dea074fce0f4cf796bd5169c341a806;p=people%2Froyger%2Fxen.git arm/processor: fix MISRA C 2012 Rule 20.7 violations In macros MPIDR_LEVEL_SHIFT() and MPIDR_AFFINITY_LEVEL(), add parentheses around the macro parameters 'level' and 'mpidr', respectively, to prevent against unintended expansions. Signed-off-by: Xenia Ragiadakou Reviewed-by: Stefano Stabellini --- diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h index 55f56b33bc..1dd81d7d52 100644 --- a/xen/arch/arm/include/asm/processor.h +++ b/xen/arch/arm/include/asm/processor.h @@ -127,10 +127,10 @@ #define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1) #define MPIDR_LEVEL_SHIFT(level) \ - (((1 << level) >> 1) << MPIDR_LEVEL_BITS_SHIFT) + (((1 << (level)) >> 1) << MPIDR_LEVEL_BITS_SHIFT) #define MPIDR_AFFINITY_LEVEL(mpidr, level) \ - ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK) + (((mpidr) >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK) #define AFFINITY_MASK(level) ~((_AC(0x1,UL) << MPIDR_LEVEL_SHIFT(level)) - 1)