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

kbuild test robot
2019-10-05T14:54:57Z

[-- Attachment #1: Type: text/plain, Size: 8792 bytes --]

Hi Kees,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[cannot apply to v5.4-rc1 next-20191004]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Kees-Cook/dma-mapping-Move-vmap-address-checks-into-dma_map_single/20191005-073954
config: i386-randconfig-d001-201939 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

In file included from include/linux/init.h:5:0,
from sound/pci/ad1889.c:23:
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
include/linux/dma-mapping.h:588:9: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
"%s %s: driver maps %lu bytes from vmalloc area\n",
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> include/linux/dma-mapping.h:587:2: note: in expansion of macro 'if'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~
include/asm-generic/bug.h:124:3: note: in expansion of macro '__WARN_printf'
__WARN_printf(TAINT_WARN, format); \
^~~~~~~~~~~~~
include/asm-generic/bug.h:155:3: note: in expansion of macro 'WARN'
WARN(1, format); \
^~~~
include/linux/dma-mapping.h:587:6: note: in expansion of macro 'WARN_ONCE'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~~~~~~~~
include/linux/dma-mapping.h:588:9: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
"%s %s: driver maps %lu bytes from vmalloc area\n",
^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> include/linux/dma-mapping.h:587:2: note: in expansion of macro 'if'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~
include/asm-generic/bug.h:124:3: note: in expansion of macro '__WARN_printf'
__WARN_printf(TAINT_WARN, format); \
^~~~~~~~~~~~~
include/asm-generic/bug.h:155:3: note: in expansion of macro 'WARN'
WARN(1, format); \
^~~~
include/linux/dma-mapping.h:587:6: note: in expansion of macro 'WARN_ONCE'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~~~~~~~~
include/linux/dma-mapping.h:588:9: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
"%s %s: driver maps %lu bytes from vmalloc area\n",
^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
(cond) ? \
^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~~~~~~~~~~~
>> include/linux/dma-mapping.h:587:2: note: in expansion of macro 'if'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~
include/asm-generic/bug.h:124:3: note: in expansion of macro '__WARN_printf'
__WARN_printf(TAINT_WARN, format); \
^~~~~~~~~~~~~
include/asm-generic/bug.h:155:3: note: in expansion of macro 'WARN'
WARN(1, format); \
^~~~
include/linux/dma-mapping.h:587:6: note: in expansion of macro 'WARN_ONCE'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~~~~~~~~
--
In file included from include/linux/export.h:44:0,
from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/delay.h:22,
from sound/pci//hda/hda_intel.c:23:
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
include/linux/dma-mapping.h:588:9: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
"%s %s: driver maps %lu bytes from vmalloc area\n",
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> include/linux/dma-mapping.h:587:2: note: in expansion of macro 'if'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~
include/asm-generic/bug.h:124:3: note: in expansion of macro '__WARN_printf'
__WARN_printf(TAINT_WARN, format); \
^~~~~~~~~~~~~
include/asm-generic/bug.h:155:3: note: in expansion of macro 'WARN'
WARN(1, format); \
^~~~
include/linux/dma-mapping.h:587:6: note: in expansion of macro 'WARN_ONCE'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~~~~~~~~
include/linux/dma-mapping.h:588:9: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
"%s %s: driver maps %lu bytes from vmalloc area\n",
^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> include/linux/dma-mapping.h:587:2: note: in expansion of macro 'if'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~
include/asm-generic/bug.h:124:3: note: in expansion of macro '__WARN_printf'
__WARN_printf(TAINT_WARN, format); \
^~~~~~~~~~~~~
include/asm-generic/bug.h:155:3: note: in expansion of macro 'WARN'
WARN(1, format); \
^~~~
include/linux/dma-mapping.h:587:6: note: in expansion of macro 'WARN_ONCE'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~~~~~~~~
include/linux/dma-mapping.h:588:9: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
"%s %s: driver maps %lu bytes from vmalloc area\n",
^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
(cond) ? \
^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~~~~~~~~~~~
>> include/linux/dma-mapping.h:587:2: note: in expansion of macro 'if'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~
include/asm-generic/bug.h:124:3: note: in expansion of macro '__WARN_printf'
__WARN_printf(TAINT_WARN, format); \
^~~~~~~~~~~~~
include/asm-generic/bug.h:155:3: note: in expansion of macro 'WARN'
WARN(1, format); \
^~~~
include/linux/dma-mapping.h:587:6: note: in expansion of macro 'WARN_ONCE'
if (WARN_ONCE(is_vmalloc_addr(ptr),
^~~~~~~~~
In file included from sound/pci//hda/hda_intel_trace.h:54:0,
from sound/pci//hda/hda_intel.c:58:
include/trace/define_trace.h: At top level:
include/trace/define_trace.h:95:42: fatal error: ./hda_intel_trace.h: No such file or directory
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
^
compilation terminated.

vim +/if +587 include/linux/dma-mapping.h

582
583 static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
584 size_t size, enum dma_data_direction dir, unsigned long attrs)
585 {
586 /* DMA must never operate on areas that might be remapped. */
> 587 if (WARN_ONCE(is_vmalloc_addr(ptr),
> 588 "%s %s: driver maps %lu bytes from vmalloc area\n",
589 dev ? dev_driver_string(dev) : "unknown driver",
590 dev ? dev_name(dev) : "unknown device", size))
591 return DMA_MAPPING_ERROR;
592
593 debug_dma_map_single(dev, ptr, size);
594 return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
595 size, dir, attrs);
596 }
597

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33925 bytes --]