summaryrefslogtreecommitdiff
path: root/drivers/iommu/io-pgtable-arm-v7s.c
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2017-06-22 18:53:50 +0300
committerWill Deacon <will.deacon@arm.com>2017-06-23 19:57:58 +0300
commit9db829d2818501f07583542c05d01513b9161e14 (patch)
treec5e18068241aabedc88d216f2526daf5b148d4de /drivers/iommu/io-pgtable-arm-v7s.c
parent5c2d0218290afa3c335f38583bf4f8e8adad4c76 (diff)
downloadlinux-9db829d2818501f07583542c05d01513b9161e14.tar.xz
iommu/io-pgtable-arm-v7s: Check table PTEs more precisely
Whilst we don't support the PXN bit at all, so should never encounter a level 1 section or supersection PTE with it set, it would still be wise to check both table type bits to resolve any theoretical ambiguity. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/iommu/io-pgtable-arm-v7s.c')
-rw-r--r--drivers/iommu/io-pgtable-arm-v7s.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index f8869951610c..46da7aa7c7d0 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -92,7 +92,8 @@
#define ARM_V7S_PTE_TYPE_CONT_PAGE 0x1
#define ARM_V7S_PTE_IS_VALID(pte) (((pte) & 0x3) != 0)
-#define ARM_V7S_PTE_IS_TABLE(pte, lvl) (lvl == 1 && ((pte) & ARM_V7S_PTE_TYPE_TABLE))
+#define ARM_V7S_PTE_IS_TABLE(pte, lvl) \
+ ((lvl) == 1 && (((pte) & 0x3) == ARM_V7S_PTE_TYPE_TABLE))
/* Page table bits */
#define ARM_V7S_ATTR_XN(lvl) BIT(4 * (2 - (lvl)))