Commit 4a0d3f3a authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Linus Torvalds

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: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Kyle McMartin <kyle@parisc-linux.org>
Cc: Matthew Wilcox <matthew@wil.cx>
Acked-by: default avatarGrant Grundler <grundler@parisc-linux.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 41f7f60d
...@@ -366,8 +366,8 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) ...@@ -366,8 +366,8 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
** ggg sacrifices another 710 to the computer gods. ** ggg sacrifices another 710 to the computer gods.
*/ */
boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, 1 << IOVP_SHIFT); boundary_size = ALIGN((unsigned long long)dma_get_seg_boundary(dev) + 1,
boundary_size >>= IOVP_SHIFT; 1ULL << IOVP_SHIFT) >> IOVP_SHIFT;
if (pages_needed <= 8) { if (pages_needed <= 8) {
/* /*
......
...@@ -341,8 +341,8 @@ sba_search_bitmap(struct ioc *ioc, struct device *dev, ...@@ -341,8 +341,8 @@ sba_search_bitmap(struct ioc *ioc, struct device *dev,
unsigned long shift; unsigned long shift;
int ret; int ret;
boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, 1 << IOVP_SHIFT); boundary_size = ALIGN((unsigned long long)dma_get_seg_boundary(dev) + 1,
boundary_size >>= IOVP_SHIFT; 1ULL << IOVP_SHIFT) >> IOVP_SHIFT;
#if defined(ZX1_SUPPORT) #if defined(ZX1_SUPPORT)
BUG_ON(ioc->ibase & ~IOVP_MASK); BUG_ON(ioc->ibase & ~IOVP_MASK);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment