From: FUJITA Tomonori Date: Wed, 5 Mar 2008 08:09:30 +0000 (+0900) Subject: parisc: fix IOMMU's device boundary overflow bug on 32bits arch X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4a0d3f3afddf01dfcfdcc826f0b706dbc01f4ef4;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git parisc: fix IOMMU's device boundary overflow bug on 32bits arch On 32bits boxes, boundary_size becomes zero due to a overflow and we hit BUG_ON in iommu_is_span_boundary. Signed-off-by: FUJITA Tomonori Cc: Kyle McMartin Cc: Matthew Wilcox Acked-by: Grant Grundler Signed-off-by: Linus Torvalds --- diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 60d338cd8009..62db3c3fe4dc 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -366,8 +366,8 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) ** ggg sacrifices another 710 to the computer gods. */ - boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, 1 << IOVP_SHIFT); - boundary_size >>= IOVP_SHIFT; + boundary_size = ALIGN((unsigned long long)dma_get_seg_boundary(dev) + 1, + 1ULL << IOVP_SHIFT) >> IOVP_SHIFT; if (pages_needed <= 8) { /* diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index e834127a8505..bdbe780e21c5 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -341,8 +341,8 @@ sba_search_bitmap(struct ioc *ioc, struct device *dev, unsigned long shift; int ret; - boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, 1 << IOVP_SHIFT); - boundary_size >>= IOVP_SHIFT; + boundary_size = ALIGN((unsigned long long)dma_get_seg_boundary(dev) + 1, + 1ULL << IOVP_SHIFT) >> IOVP_SHIFT; #if defined(ZX1_SUPPORT) BUG_ON(ioc->ibase & ~IOVP_MASK);