[alsa-devel] [PATCH] ASoC: omap-pcm: Lower the dma coherent mask to 32bits

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Dec 5 22:07:07 CET 2013

On Thu, Dec 05, 2013 at 09:11:50PM +0100, Takashi Iwai wrote:
> Does the check of dma_to_pfn(dev, ~0) is really necessary?

Of course.

> In get_coherent_dma_mask(), it checks further
> 		if (dma_to_pfn(dev, mask) < max_dma_pfn) {
> and since mask > ~0, this check should suffice, I think.

dma_to_pfn() takes a dma_addr_t as the second argument.  At this point,
we've ascertained that 'mask' is larger than dma_addr_t, so the above
will truncate the mask.

The whole point of this is to protect the following code which does
exactly that from this truncation.

More information about the Alsa-devel mailing list