parisc: fix IOMMU's device boundary overflow bug on 32bits arch
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Wed, 5 Mar 2008 08:09:30 +0000 (17:09 +0900)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 6 Mar 2008 01:55:13 +0000 (17:55 -0800)
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 <fujita.tomonori@lab.ntt.co.jp>
Cc: Kyle McMartin <kyle@parisc-linux.org>
Cc: Matthew Wilcox <matthew@wil.cx>
Acked-by: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/parisc/ccio-dma.c
drivers/parisc/sba_iommu.c

index 60d338cd80090ff02dd20cc9e1fec5b684e8f588..62db3c3fe4dcbd35dcd6181c4061954e4b0b0d87 100644 (file)
@@ -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) {
                /*
index e834127a8505350554806369e3d31e9cba129440..bdbe780e21c51e36de99d359c4304bfac2cc2054 100644 (file)
@@ -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);