Skip to contentSkip to conversation

iommu/sun50i: fix protection flag check

PATCH In review David Stevens 2 participants 2 messages Jul 16, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/sun50i: fix protection flag check

From: David Stevens <[email protected]>

Fix RW protection check when making a pte, so that it properly checks that both R and W flags are set, instead of either R or W.

---
 drivers/iommu/sun50i-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/sun50i-iommu.c +1 -1
index 181bb1c3437c..11cf5af30956 100644
@@ -271,7 +271,7 @@ static u32 sun50i_mk_pte(phys_addr_t page, int prot)
 	enum sun50i_iommu_aci aci;
 	u32 flags = 0;
 
-	if (prot & (IOMMU_READ | IOMMU_WRITE))
+	if ((prot & IOMMU_READ) && (prot & IOMMU_WRITE))
 		aci = SUN50I_IOMMU_ACI_RD_WR;
 	else if (prot & IOMMU_READ)
 		aci = SUN50I_IOMMU_ACI_RD;
Signature · 1 line
2.32.0.402.g57bb445576-goog