Re: [PATCH v2] dma-mapping: Move vmap address checks into dma_map_single()

Christoph Hellwig
2019-10-05T08:40:41Z

Please split the usb and dma-mapping parts into separate patches.

> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index 4a1c4fca475a..12dbd07f74f2 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -583,6 +583,13 @@ static inline unsigned long dma_get_merge_boundary(struct device *dev)
> static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
> size_t size, enum dma_data_direction dir, unsigned long attrs)
> {
> + /* DMA must never operate on areas that might be remapped. */
> + if (WARN_ONCE(is_vmalloc_addr(ptr),
> + "%s %s: driver maps %lu bytes from vmalloc area\n",
> + dev ? dev_driver_string(dev) : "unknown driver",
> + dev ? dev_name(dev) : "unknown device", size))
> + return DMA_MAPPING_ERROR;

a NULL device isn't supported any more, so we can remove the handling
for it here.