aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-06-27 14:00:32 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-06-29 07:38:42 -0400
commit66eae8469e4e4ba6f4ca7ef82103c78f6d645583 (patch)
treeadb12962ecead5e169265aaefdf7c4472609a504 /drivers/pci/intel-iommu.c
parenta75f7cf94f01717c5103138319b96752ee2a2be9 (diff)
intel-iommu: Don't just mask out too-big physical addresses; BUG() instead
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r--drivers/pci/intel-iommu.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 40eae2097aca..ad367f53a2bb 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -700,8 +700,7 @@ static struct dma_pte * addr_to_dma_pte(struct dmar_domain *domain, u64 addr)
700 unsigned long flags; 700 unsigned long flags;
701 701
702 BUG_ON(!domain->pgd); 702 BUG_ON(!domain->pgd);
703 703 BUG_ON(addr >> addr_width);
704 addr &= (((u64)1) << addr_width) - 1;
705 parent = domain->pgd; 704 parent = domain->pgd;
706 705
707 spin_lock_irqsave(&domain->mapping_lock, flags); 706 spin_lock_irqsave(&domain->mapping_lock, flags);
@@ -783,8 +782,9 @@ static void dma_pte_clear_range(struct dmar_domain *domain, u64 start, u64 end)
783 int addr_width = agaw_to_width(domain->agaw); 782 int addr_width = agaw_to_width(domain->agaw);
784 int npages; 783 int npages;
785 784
786 start &= (((u64)1) << addr_width) - 1; 785 BUG_ON(start >> addr_width);
787 end &= (((u64)1) << addr_width) - 1; 786 BUG_ON((end-1) >> addr_width);
787
788 /* in case it's partial page */ 788 /* in case it's partial page */
789 start &= PAGE_MASK; 789 start &= PAGE_MASK;
790 end = PAGE_ALIGN(end); 790 end = PAGE_ALIGN(end);
@@ -807,8 +807,8 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain,
807 int level; 807 int level;
808 u64 tmp; 808 u64 tmp;
809 809
810 start &= (((u64)1) << addr_width) - 1; 810 BUG_ON(start >> addr_width);
811 end &= (((u64)1) << addr_width) - 1; 811 BUG_ON(end >> addr_width);
812 812
813 /* we don't need lock here, nobody else touches the iova range */ 813 /* we don't need lock here, nobody else touches the iova range */
814 level = 2; 814 level = 2;
@@ -1654,7 +1654,7 @@ domain_page_mapping(struct dmar_domain *domain, dma_addr_t iova,
1654 int index; 1654 int index;
1655 int addr_width = agaw_to_width(domain->agaw); 1655 int addr_width = agaw_to_width(domain->agaw);
1656 1656
1657 hpa &= (((u64)1) << addr_width) - 1; 1657 BUG_ON(hpa >> addr_width);
1658 1658
1659 if ((prot & (DMA_PTE_READ|DMA_PTE_WRITE)) == 0) 1659 if ((prot & (DMA_PTE_READ|DMA_PTE_WRITE)) == 0)
1660 return -EINVAL; 1660 return -EINVAL;