Skip to content

Commit

Permalink
arm64: Align CMA sizes to PAGE_SIZE
Browse files Browse the repository at this point in the history
dma_alloc_from_contiguous takes number of pages for a size.
Align up the dma size passed in to page size to avoid truncation
and allocation failures on sizes less than PAGE_SIZE.

Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
  • Loading branch information
Laura Abbott authored and Catalin Marinas committed Feb 5, 2014
1 parent 5044bad commit ccc9e24
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm64/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size,
if (IS_ENABLED(CONFIG_DMA_CMA)) {
struct page *page;

size = PAGE_ALIGN(size);
page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT,
get_order(size));
if (!page)
Expand Down

0 comments on commit ccc9e24

Please sign in to comment.