linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dma-mapping: always clear allocated buffers
@ 2018-07-24 14:04 YueHaibing
  2018-07-24 18:09 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2018-07-24 14:04 UTC (permalink / raw)
  To: linux, matthias.bgg, vladimir.murzin
  Cc: linux-kernel, linux-mediatek, linux-arm-kernel, akpm,
	iamjoonsoo.kim, robin.murphy, treding, zhongjiang, YueHaibing

Sean Wang report dma_zalloc_coherent doesn't work as expect on his
armv7,the allocated mem is not zeroed.The reason is __alloc_from_pool
doesn't honor __GFP_ZERO.

Like commit 6829e274a623 ("arm64: dma-mapping: always clear allocated buffers")
does,always clear allocated buffers to fix this.

Reported-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: zhong jiang <zhongjiang@huawei.com>
---
 arch/arm/mm/dma-mapping.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 6656647..cf5882f 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -564,6 +564,7 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)
 
 		*ret_page = phys_to_page(phys);
 		ptr = (void *)val;
+		memset(ptr, 0, size);
 	}
 
 	return ptr;
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: dma-mapping: always clear allocated buffers
  2018-07-24 14:04 [PATCH] ARM: dma-mapping: always clear allocated buffers YueHaibing
@ 2018-07-24 18:09 ` Christoph Hellwig
  2018-07-25  2:24   ` YueHaibing
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2018-07-24 18:09 UTC (permalink / raw)
  To: YueHaibing
  Cc: linux, matthias.bgg, vladimir.murzin, linux-kernel,
	linux-mediatek, linux-arm-kernel, akpm, iamjoonsoo.kim,
	robin.murphy, treding, zhongjiang

On Tue, Jul 24, 2018 at 10:04:35PM +0800, YueHaibing wrote:
> Sean Wang report dma_zalloc_coherent doesn't work as expect on his
> armv7,the allocated mem is not zeroed.The reason is __alloc_from_pool
> doesn't honor __GFP_ZERO.

Please explain the "why" a little more.  All the explanations are in
the referenced arm64 commit and should be mentioned here as well.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: dma-mapping: always clear allocated buffers
  2018-07-24 18:09 ` Christoph Hellwig
@ 2018-07-25  2:24   ` YueHaibing
  0 siblings, 0 replies; 3+ messages in thread
From: YueHaibing @ 2018-07-25  2:24 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux, matthias.bgg, vladimir.murzin, linux-kernel,
	linux-mediatek, linux-arm-kernel, akpm, iamjoonsoo.kim,
	robin.murphy, treding, zhongjiang

On 2018/7/25 2:09, Christoph Hellwig wrote:
> On Tue, Jul 24, 2018 at 10:04:35PM +0800, YueHaibing wrote:
>> Sean Wang report dma_zalloc_coherent doesn't work as expect on his
>> armv7,the allocated mem is not zeroed.The reason is __alloc_from_pool
>> doesn't honor __GFP_ZERO.
> 
> Please explain the "why" a little more.  All the explanations are in
> the referenced arm64 commit and should be mentioned here as well.

ok, will send v2.

> 
> .
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-25  2:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-24 14:04 [PATCH] ARM: dma-mapping: always clear allocated buffers YueHaibing
2018-07-24 18:09 ` Christoph Hellwig
2018-07-25  2:24   ` YueHaibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).