On Wed, Mar 13, 2024 at 10:40:06AM +0800, Boshi Yu wrote: > On Tue, Mar 12, 2024 at 12:53:05PM +0200, Leon Romanovsky wrote: > > On Mon, Mar 11, 2024 at 07:38:21PM +0800, Boshi Yu wrote: > > > From: Boshi Yu <boshiyu@xxxxxxxxxxxxxxxxx> > > > > > > The dma_alloc_coherent() interface automatically zero the memory returned. > > > > Can you please point to the DMA code which does that? > > We have noticed a patchset which ensures that dma_alloc_coherent() always > returns zeroed memory. The url of this patchset is listed as below: > https://lore.kernel.org/all/20181214082515.14835-1-hch@xxxxxx/T/#m70c723c646004445713f31b7837f7e9d910c06f5 > > Besides, you may refer to commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*") > for details. This commit zeros memory by passing __GFP_ZERO flag or > calling memset internally. For example, the dma_alloc_direct() interface > calls memset() to zero the allocated memory. Thanks