[PATCH 6/7] ALSA: memalloc: don't pass bogus GFP_ flags to dma_alloc_*

Takashi Iwai tiwai at suse.de
Mon Nov 14 01:04:37 PST 2022


On Sun, 13 Nov 2022 17:35:34 +0100,
Christoph Hellwig wrote:
> 
> dma_alloc_coherent/dma_alloc_wc is an opaque allocator that only uses
> the GFP_ flags for allocation context control.  Don't pass __GFP_COMP
> which makes no sense for an allocation that can't in any way be
> converted to a page pointer.

The addition of __GFP_COMP there was really old, it was Hugh's commit
f3d48f0373c1 at 2005:
    [PATCH] unpaged: fix sound Bad page states

It mentions something about sparc32/64.  I hope this isn't relevant
any longer (honestly I have no idea about that).

> Note that for dma_alloc_noncoherent and dma_alloc_noncontigous in
> combination with the DMA mmap helpers __GFP_COMP looks sketchy as well,
> so I would suggest to drop that as well after a careful audit.

Yeah, that's a cargo-cult copy&paste from the old idiom.
Should be killed altogether.


Thanks!

Takashi



More information about the linux-arm-kernel mailing list