mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
dma-mapping: zero memory returned from dma_alloc_*
If we want to map memory from the DMA allocator to userspace it must be zeroed at allocation time to prevent stale data leaks. We already do this on most common architectures, but some architectures don't do this yet, fix them up, either by passing GFP_ZERO when we use the normal page allocator or doing a manual memset otherwise. Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> [m68k] Acked-by: Sam Ravnborg <[email protected]> [sparc]
This commit is contained in:
parent
6c503d0d88
commit
518a2f1925
14 changed files with 18 additions and 15 deletions
|
|
@ -404,7 +404,7 @@ static void *pcxl_dma_alloc(struct device *dev, size_t size,
|
|||
order = get_order(size);
|
||||
size = 1 << (order + PAGE_SHIFT);
|
||||
vaddr = pcxl_alloc_range(size);
|
||||
paddr = __get_free_pages(flag, order);
|
||||
paddr = __get_free_pages(flag | __GFP_ZERO, order);
|
||||
flush_kernel_dcache_range(paddr, size);
|
||||
paddr = __pa(paddr);
|
||||
map_uncached_pages(vaddr, size, paddr);
|
||||
|
|
@ -429,7 +429,7 @@ static void *pcx_dma_alloc(struct device *dev, size_t size,
|
|||
if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
|
||||
return NULL;
|
||||
|
||||
addr = (void *)__get_free_pages(flag, get_order(size));
|
||||
addr = (void *)__get_free_pages(flag | __GFP_ZERO, get_order(size));
|
||||
if (addr)
|
||||
*dma_handle = (dma_addr_t)virt_to_phys(addr);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue