From: Laura Abbott Date: Tue, 4 Feb 2014 23:08:57 +0000 (+0000) Subject: arm64: Align CMA sizes to PAGE_SIZE X-Git-Tag: firefly_0821_release~3680^2~122^2~2^2~9^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7e7f87dda0fbc095f27f3ccd97aed18c2542b93c;p=firefly-linux-kernel-4.4.55.git arm64: Align CMA sizes to PAGE_SIZE 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 Signed-off-by: Laura Abbott Signed-off-by: Catalin Marinas (cherry picked from commit ccc9e244eb1b9654915634827322932cbafd8244) Signed-off-by: Alex Shi --- diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index c4c005cc2ed2..0150f5d14eda 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -40,6 +40,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)