]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
arm/processor: fix MISRA C 2012 Rule 20.7 violations
authorXenia Ragiadakou <burzalodowa@gmail.com>
Wed, 24 Aug 2022 12:23:00 +0000 (14:23 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 24 Aug 2022 12:23:00 +0000 (14:23 +0200)
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 <burzalodowa@gmail.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/include/asm/processor.h

index 55f56b33bcced81bd094d526125322ac0b9b6939..1dd81d7d528fcde9a4741e744529a55dbba125bf 100644 (file)
 #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)