[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/arm: smmu-v3: Fix MISRA C 2012 Rule 1.3 violations



commit 93aa071f66b78a2abbf134aeb96b02f066e6091d
Author:     Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
AuthorDate: Tue Jun 28 18:08:51 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Tue Jun 28 17:41:27 2022 -0700

    xen/arm: smmu-v3: Fix MISRA C 2012 Rule 1.3 violations
    
    The expression 1 << 31 produces undefined behaviour because the type of 
integer
    constant 1 is (signed) int and the result of shifting 1 by 31 bits is not
    representable in the (signed) int type.
    Change the type of 1 to unsigned int by adding the U suffix.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
    Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
b/xen/drivers/passthrough/arm/smmu-v3.c
index 1e857f915a..f2562acc38 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -338,7 +338,7 @@ static int platform_get_irq_byname_optional(struct device 
*dev,
 #define CR2_E2H                                (1 << 0)
 
 #define ARM_SMMU_GBPA                  0x44
-#define GBPA_UPDATE                    (1 << 31)
+#define GBPA_UPDATE                    (1U << 31)
 #define GBPA_ABORT                     (1 << 20)
 
 #define ARM_SMMU_IRQ_CTRL              0x50
@@ -410,7 +410,7 @@ static int platform_get_irq_byname_optional(struct device 
*dev,
 
 #define Q_IDX(llq, p)                  ((p) & ((1 << (llq)->max_n_shift) - 1))
 #define Q_WRP(llq, p)                  ((p) & (1 << (llq)->max_n_shift))
-#define Q_OVERFLOW_FLAG                        (1 << 31)
+#define Q_OVERFLOW_FLAG                        (1U << 31)
 #define Q_OVF(p)                       ((p) & Q_OVERFLOW_FLAG)
 #define Q_ENT(q, p)                    ((q)->base +                    \
                                         Q_IDX(&((q)->llq), p) *        \
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.