xen/arm: Surround HSR_SYSREG macro value with ()
PATCH 1/1 xen/arm: Surround HSR_SYSREG macro value with ()
The value of the macro HCR_SYSREG is not surrounded by (). This means the behavior may change depend on how it is used.
Thanksfully recent GCC will issue a warning for that.
---
I am not aware of any "bad" usage today in Xen. This was found whilst playing with sysreg emulation and GCC complaining about the missing ().
--- xen/include/asm-arm/arm64/sysregs.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
xen/include/asm-arm/arm64/sysregs.h +5 -5
@@ -32,11 +32,11 @@/* These are used to decode traps with HSR.EC==HSR_EC_SYSREG */ #define HSR_SYSREG (op0,op1,crn,crm,op2) \ - ((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \ - ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \ - ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \ - ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \ - ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT) + (((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \ + ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \ + ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \ + ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \ + ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT))#define HSR_SYSREG_DCISW HSR_SYSREG(1,0,c7,c6,2)#define HSR_SYSREG_DCCSW HSR_SYSREG(1,0,c7,c10,2)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi,
Ping?
Cheers,
Quoted 37 lines · Julien Grall
The value of the macro
HCR_SYSREGis not surrounded by (). This means the behavior may change depend on how it is used.Thanksfully recent GCC will issue a warning for that.
Signed-off-by Julien Grall <[email protected]>---
I am not aware of any "bad" usage today in Xen. This was found whilst playing with sysreg emulation and GCC complaining about the missing ().
--- xen/include/asm-arm/arm64/sysregs.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)xen/include/asm-arm/arm64/sysregs.h +5
-5@@ -32,11 +32,11 @@/* These are used to decode traps with HSR.EC==HSR_EC_SYSREG */ #define HSR_SYSREG (op0,op1,crn,crm,op2) \ - ((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \ - ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \ - ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \ - ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \ - ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT) + (((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \ + ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \ + ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \ + ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \ + ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT))#define HSR_SYSREG_DCISW HSR_SYSREG(1,0,c7,c6,2)#define HSR_SYSREG_DCCSW HSR_SYSREG(1,0,c7,c10,2)
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 13 lines · Julien Grall
Hi,
Ping?
Cheers,
Quoted 6 lines · Julien Grall
The value of the macro
HCR_SYSREGis not surrounded by (). This means the behavior may change depend on how it is used.Thanksfully recent GCC will issue a warning for that.
Signed-off-by Julien Grall <[email protected]>
reviewed and committed
Quoted 21 lines
Quoted 21 lines
---
I am not aware of any "bad" usage today in Xen. This was found whilst playing with sysreg emulation and GCC complaining about the missing ().
--- xen/include/asm-arm/arm64/sysregs.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)xen/include/asm-arm/arm64/sysregs.h +0
-5@@ -32,11 +32,11 @@/* These are used to decode traps with HSR.EC==HSR_EC_SYSREG */ #define HSR_SYSREG (op0,op1,crn,crm,op2) \ - ((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \ - ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \ - ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \ - ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \ - ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT)
Quoted 12 lines
Quoted 8 lines
xen/include/asm-arm/arm64/sysregs.h +5
-0+ (((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \ + ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \ + ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \ + ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \ + ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT))#define HSR_SYSREG_DCISW HSR_SYSREG(1,0,c7,c6,2)#define HSR_SYSREG_DCCSW HSR_SYSREG(1,0,c7,c10,2)Signature · 1 line
Julien Grall
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel