]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
iommu/io-pgtable-arm-v7s: Check table PTEs more precisely
authorRobin Murphy <robin.murphy@arm.com>
Thu, 22 Jun 2017 15:53:50 +0000 (16:53 +0100)
committerWill Deacon <will.deacon@arm.com>
Fri, 23 Jun 2017 16:57:58 +0000 (17:57 +0100)
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>
drivers/iommu/io-pgtable-arm-v7s.c

index f8869951610c06e41aefe43093ce9889c6d5ac9e..46da7aa7c7d0f100b188f520bcf4452e9b7e928b 100644 (file)
@@ -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)))