[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/arm32: vfp: Add missing U for shifted constant
commit 2a6da58442ded2b6199f0ff15f5d8a85ab923d85 Author: Julien Grall <jgrall@xxxxxxxxxx> AuthorDate: Thu Jun 29 20:57:10 2023 +0100 Commit: Julien Grall <jgrall@xxxxxxxxxx> CommitDate: Thu Jun 29 20:58:09 2023 +0100 xen/arm32: vfp: Add missing U for shifted constant When enabling UBSAN on arm32, the following splat will be printed: (XEN) ================================================================================ (XEN) UBSAN: Undefined behaviour in arch/arm/arm32/vfp.c:75:22 (XEN) left shift of 255 by 24 places cannot be represented in type 'int' This is referring to the shift in FPSID_IMPLEMENTER_MASK. While we could only add the U to the value shift there, it would be better to be consistent and also add it for every value shifted. This should also addressing MISRA Rule 7.2: A "u" or "U" suffix shall be applied to all integer constants that are represented in an unsigned type Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx> Reviewed-by: Henry Wang <Henry.Wang@xxxxxxx> Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx> --- xen/arch/arm/include/asm/arm32/vfp.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/include/asm/arm32/vfp.h b/xen/arch/arm/include/asm/arm32/vfp.h index bade3bc66e..2f2e4b24bb 100644 --- a/xen/arch/arm/include/asm/arm32/vfp.h +++ b/xen/arch/arm/include/asm/arm32/vfp.h @@ -1,23 +1,23 @@ #ifndef _ARM_ARM32_VFP_H #define _ARM_ARM32_VFP_H -#define FPEXC_EX (1u << 31) -#define FPEXC_EN (1u << 30) -#define FPEXC_FP2V (1u << 28) +#define FPEXC_EX (1U << 31) +#define FPEXC_EN (1U << 30) +#define FPEXC_FP2V (1U << 28) -#define MVFR0_A_SIMD_MASK (0xf << 0) +#define MVFR0_A_SIMD_MASK (0xfU << 0) #define FPSID_IMPLEMENTER_BIT (24) -#define FPSID_IMPLEMENTER_MASK (0xff << FPSID_IMPLEMENTER_BIT) +#define FPSID_IMPLEMENTER_MASK (0xffU << FPSID_IMPLEMENTER_BIT) #define FPSID_ARCH_BIT (16) -#define FPSID_ARCH_MASK (0xf << FPSID_ARCH_BIT) +#define FPSID_ARCH_MASK (0xfU << FPSID_ARCH_BIT) #define FPSID_PART_BIT (8) -#define FPSID_PART_MASK (0xff << FPSID_PART_BIT) +#define FPSID_PART_MASK (0xffU << FPSID_PART_BIT) #define FPSID_VARIANT_BIT (4) -#define FPSID_VARIANT_MASK (0xf << FPSID_VARIANT_BIT) +#define FPSID_VARIANT_MASK (0xfU << FPSID_VARIANT_BIT) #define FPSID_REV_BIT (0) -#define FPSID_REV_MASK (0xf << FPSID_REV_BIT) +#define FPSID_REV_MASK (0xfU << FPSID_REV_BIT) struct vfp_state { -- generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |