Skip to contentSkip to conversation

iommu/arm: ipmmu-vmsa: Use 1U << 31 rather than 1 << 31

PATCH In review Oleksandr Tyshchenko 3 participants 3 messages Jan 11, 2021 – Jan 12, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/arm: ipmmu-vmsa: Use 1U << 31 rather than 1 << 31

From: Oleksandr Tyshchenko <[email protected]>

Replace all the use of 1 << 31 with 1U << 31 to prevent undefined behavior in the IPMMU-VMSA driver.

---
This is a follow-up to
https://patchew.org/Xen/[email protected]/

---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/drivers/passthrough/arm/ipmmu-vmsa.c +2 -2
index 346165c..aef358d 100644
@@ -187,7 +187,7 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMCAAR               0x0004
 
 #define IMTTBCR                        0x0008
-#define IMTTBCR_EAE                    (1 << 31)
+#define IMTTBCR_EAE                    (1U << 31)
 #define IMTTBCR_PMB                    (1 << 30)
 #define IMTTBCR_SH1_NON_SHAREABLE      (0 << 28)
 #define IMTTBCR_SH1_OUTER_SHAREABLE    (2 << 28)
@@ -251,7 +251,7 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUCTR(n)              ((n) < 32 ? IMUCTR0(n) : IMUCTR32(n))
 #define IMUCTR0(n)             (0x0300 + ((n) * 16))
 #define IMUCTR32(n)            (0x0600 + (((n) - 32) * 16))
-#define IMUCTR_FIXADDEN        (1 << 31)
+#define IMUCTR_FIXADDEN        (1U << 31)
 #define IMUCTR_FIXADD_MASK     (0xff << 16)
 #define IMUCTR_FIXADD_SHIFT    16
 #define IMUCTR_TTSEL_MMU(n)    ((n) << 4)
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Replace all the use of 1 << 31 with 1U << 31 to prevent undefined behavior in the IPMMU-VMSA driver.

Quoted 32 lines

---
This is a follow-up to
https://patchew.org/Xen/[email protected]/

---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/drivers/passthrough/arm/ipmmu-vmsa.c +2 -2
index 346165c..aef358d 100644
@@ -187,7 +187,7 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMCAAR               0x0004
 
 #define IMTTBCR                        0x0008
-#define IMTTBCR_EAE                    (1 << 31)
+#define IMTTBCR_EAE                    (1U << 31)
 #define IMTTBCR_PMB                    (1 << 30)
 #define IMTTBCR_SH1_NON_SHAREABLE      (0 << 28)
 #define IMTTBCR_SH1_OUTER_SHAREABLE    (2 << 28)
@@ -251,7 +251,7 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUCTR(n)              ((n) < 32 ? IMUCTR0(n) : IMUCTR32(n))
 #define IMUCTR0(n)             (0x0300 + ((n) * 16))
 #define IMUCTR32(n)            (0x0600 + (((n) - 32) * 16))
-#define IMUCTR_FIXADDEN        (1 << 31)
+#define IMUCTR_FIXADDEN        (1U << 31)
 #define IMUCTR_FIXADD_MASK     (0xff << 16)
 #define IMUCTR_FIXADD_SHIFT    16
 #define IMUCTR_TTSEL_MMU(n)    ((n) << 4)
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#2 lore raw
In reply to Oleksandr Tyshchenko
Quoted 10 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Replace all the use of 1 << 31 with 1U << 31 to prevent undefined behavior in the IPMMU-VMSA driver.

Cheers
Bertrand

Quoted 33 lines

---
This is a follow-up to
https://patchew.org/Xen/[email protected]/
---
xen/drivers/passthrough/arm/ipmmu-vmsa.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
xen/drivers/passthrough/arm/ipmmu-vmsa.c +2 -2
index 346165c..aef358d 100644
@@ -187,7 +187,7 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMCAAR               0x0004
 
 #define IMTTBCR                        0x0008
-#define IMTTBCR_EAE                    (1 << 31)
+#define IMTTBCR_EAE                    (1U << 31)
 #define IMTTBCR_PMB                    (1 << 30)
 #define IMTTBCR_SH1_NON_SHAREABLE      (0 << 28)
 #define IMTTBCR_SH1_OUTER_SHAREABLE    (2 << 28)
@@ -251,7 +251,7 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUCTR(n)              ((n) < 32 ? IMUCTR0(n) : IMUCTR32(n))
 #define IMUCTR0(n)             (0x0300 + ((n) * 16))
 #define IMUCTR32(n)            (0x0600 + (((n) - 32) * 16))
-#define IMUCTR_FIXADDEN        (1 << 31)
+#define IMUCTR_FIXADDEN        (1U << 31)
 #define IMUCTR_FIXADD_MASK     (0xff << 16)
 #define IMUCTR_FIXADD_SHIFT    16
 #define IMUCTR_TTSEL_MMU(n)    ((n) << 4)
Signature · 1 line
2.7.4