mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
ARM: dma-mapping: Treat bitmap size as allocation failure
bitmap_find_next_zero_area() uses an out-of-range return value to indicate failure. Check for values greater than or equal to the bitmap size so the caller does not depend on the exact failure sentinel. Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Yury Norov <ynorov@nvidia.com>
This commit is contained in:
parent
ae44a037ac
commit
d00e89988e
|
|
@ -773,7 +773,7 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping,
|
|||
start = bitmap_find_next_zero_area(mapping->bitmaps[i],
|
||||
mapping->bits, 0, count, align);
|
||||
|
||||
if (start > mapping->bits)
|
||||
if (start >= mapping->bits)
|
||||
continue;
|
||||
|
||||
bitmap_set(mapping->bitmaps[i], start, count);
|
||||
|
|
@ -794,7 +794,7 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping,
|
|||
start = bitmap_find_next_zero_area(mapping->bitmaps[i],
|
||||
mapping->bits, 0, count, align);
|
||||
|
||||
if (start > mapping->bits) {
|
||||
if (start >= mapping->bits) {
|
||||
spin_unlock_irqrestore(&mapping->lock, flags);
|
||||
return DMA_MAPPING_ERROR;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user