Re: [PATCH] sparse: use static inline for __chk_{user,io}_ptr()

From: kernel test robot
Date: Fri Aug 28 2020 - 10:22:52 EST


Hi Luc,

I love your patch! Perhaps something to improve:

[auto build test WARNING on 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5]

url: https://github.com/0day-ci/linux/commits/Luc-Van-Oostenryck/sparse-use-static-inline-for-__chk_-user-io-_ptr/20200828-165431
base: 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
config: x86_64-randconfig-s022-20200828 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
>> drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
>> drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: got unsigned int [usertype] *
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/radeon/radeon_ttm.c:969:21: sparse: sparse: cast removes address space '__user' of expression
--
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:828:42: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: sparse: cast removes address space '__user' of expression
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2389:21: sparse: sparse: cast removes address space '__user' of expression
--
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:384:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:399:21: sparse: sparse: cast removes address space '__user' of expression
--
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:138:17: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __poll_t ( *poll )( ... ) @@ got unsigned int ( * )( ... ) @@
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:138:17: sparse: expected restricted __poll_t ( *poll )( ... )
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:138:17: sparse: got unsigned int ( * )( ... )
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
>> drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
>> drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:261:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:263:29: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:354:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:412:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:473:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:531:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: got unsigned int [usertype] *
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:592:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:650:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:650:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:650:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:650:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:650:21: sparse: sparse: cast removes address space '__user' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:650:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int [usertype] * @@
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:650:21: sparse: expected void const volatile [noderef] __user *ptr
--
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
>> arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned long long [usertype] * @@
>> arch/x86/ia32/ia32_signal.c:350:9: sparse: expected void const volatile [noderef] __user *ptr
arch/x86/ia32/ia32_signal.c:350:9: sparse: got unsigned long long [usertype] *
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression

# https://github.com/0day-ci/linux/commit/7d01c91ac34a64f0177bc6d058cc50e805f59102
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Luc-Van-Oostenryck/sparse-use-static-inline-for-__chk_-user-io-_ptr/20200828-165431
git checkout 7d01c91ac34a64f0177bc6d058cc50e805f59102
vim +969 drivers/gpu/drm/radeon/radeon_ttm.c

771fe6b912fca5 Jerome Glisse 2009-06-05 772
771fe6b912fca5 Jerome Glisse 2009-06-05 @773 int radeon_ttm_init(struct radeon_device *rdev)
771fe6b912fca5 Jerome Glisse 2009-06-05 774 {
771fe6b912fca5 Jerome Glisse 2009-06-05 775 int r;
771fe6b912fca5 Jerome Glisse 2009-06-05 776
771fe6b912fca5 Jerome Glisse 2009-06-05 777 /* No others user of address space so set it to 0 */
771fe6b912fca5 Jerome Glisse 2009-06-05 778 r = ttm_bo_device_init(&rdev->mman.bdev,
44d847b7439bde David Herrmann 2013-08-13 779 &radeon_bo_driver,
44d847b7439bde David Herrmann 2013-08-13 780 rdev->ddev->anon_inode->i_mapping,
8b53e1cb2728b6 Gerd Hoffmann 2019-09-05 781 rdev->ddev->vma_offset_manager,
33b3ad3788aba8 Christoph Hellwig 2019-08-15 782 dma_addressing_limited(&rdev->pdev->dev));
771fe6b912fca5 Jerome Glisse 2009-06-05 783 if (r) {
771fe6b912fca5 Jerome Glisse 2009-06-05 784 DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
771fe6b912fca5 Jerome Glisse 2009-06-05 785 return r;
771fe6b912fca5 Jerome Glisse 2009-06-05 786 }
0a0c7596c64323 Jerome Glisse 2009-12-11 787 rdev->mman.initialized = true;
4c7886791264f0 Jerome Glisse 2009-11-20 788 r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_VRAM,
312ea8da049a18 Jerome Glisse 2009-12-07 789 rdev->mc.real_vram_size >> PAGE_SHIFT);
771fe6b912fca5 Jerome Glisse 2009-06-05 790 if (r) {
771fe6b912fca5 Jerome Glisse 2009-06-05 791 DRM_ERROR("Failed initializing VRAM heap.\n");
771fe6b912fca5 Jerome Glisse 2009-06-05 792 return r;
771fe6b912fca5 Jerome Glisse 2009-06-05 793 }
14eedc32a3c0ec Lauri Kasanen 2014-02-28 794 /* Change the size here instead of the init above so only lpfn is affected */
14eedc32a3c0ec Lauri Kasanen 2014-02-28 795 radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size);
14eedc32a3c0ec Lauri Kasanen 2014-02-28 796
441921d5309cfe Daniel Vetter 2011-02-18 797 r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true,
831b6966a60fe7 Maarten Lankhorst 2014-09-18 798 RADEON_GEM_DOMAIN_VRAM, 0, NULL,
4aa5b92fd48f88 Kent Russell 2017-08-08 799 NULL, &rdev->stolen_vga_memory);
771fe6b912fca5 Jerome Glisse 2009-06-05 800 if (r) {
771fe6b912fca5 Jerome Glisse 2009-06-05 801 return r;
771fe6b912fca5 Jerome Glisse 2009-06-05 802 }
4aa5b92fd48f88 Kent Russell 2017-08-08 803 r = radeon_bo_reserve(rdev->stolen_vga_memory, false);
4c7886791264f0 Jerome Glisse 2009-11-20 804 if (r)
4c7886791264f0 Jerome Glisse 2009-11-20 805 return r;
4aa5b92fd48f88 Kent Russell 2017-08-08 806 r = radeon_bo_pin(rdev->stolen_vga_memory, RADEON_GEM_DOMAIN_VRAM, NULL);
4aa5b92fd48f88 Kent Russell 2017-08-08 807 radeon_bo_unreserve(rdev->stolen_vga_memory);
771fe6b912fca5 Jerome Glisse 2009-06-05 808 if (r) {
4aa5b92fd48f88 Kent Russell 2017-08-08 809 radeon_bo_unref(&rdev->stolen_vga_memory);
771fe6b912fca5 Jerome Glisse 2009-06-05 810 return r;
771fe6b912fca5 Jerome Glisse 2009-06-05 811 }
771fe6b912fca5 Jerome Glisse 2009-06-05 812 DRM_INFO("radeon: %uM of VRAM memory ready\n",
fc986034540102 Niels Ole Salscheider 2013-05-18 813 (unsigned) (rdev->mc.real_vram_size / (1024 * 1024)));
4c7886791264f0 Jerome Glisse 2009-11-20 814 r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_TT,
312ea8da049a18 Jerome Glisse 2009-12-07 815 rdev->mc.gtt_size >> PAGE_SHIFT);
771fe6b912fca5 Jerome Glisse 2009-06-05 816 if (r) {
771fe6b912fca5 Jerome Glisse 2009-06-05 817 DRM_ERROR("Failed initializing GTT heap.\n");
771fe6b912fca5 Jerome Glisse 2009-06-05 818 return r;
771fe6b912fca5 Jerome Glisse 2009-06-05 819 }
771fe6b912fca5 Jerome Glisse 2009-06-05 820 DRM_INFO("radeon: %uM of GTT memory ready.\n",
3ce0a23d2d2531 Jerome Glisse 2009-09-08 821 (unsigned)(rdev->mc.gtt_size / (1024 * 1024)));
fa8a123855e200 Dave Airlie 2009-08-26 822
fa8a123855e200 Dave Airlie 2009-08-26 823 r = radeon_ttm_debugfs_init(rdev);
fa8a123855e200 Dave Airlie 2009-08-26 824 if (r) {
fa8a123855e200 Dave Airlie 2009-08-26 825 DRM_ERROR("Failed to init debugfs\n");
fa8a123855e200 Dave Airlie 2009-08-26 826 return r;
fa8a123855e200 Dave Airlie 2009-08-26 827 }
771fe6b912fca5 Jerome Glisse 2009-06-05 828 return 0;
771fe6b912fca5 Jerome Glisse 2009-06-05 829 }
771fe6b912fca5 Jerome Glisse 2009-06-05 830
771fe6b912fca5 Jerome Glisse 2009-06-05 831 void radeon_ttm_fini(struct radeon_device *rdev)
771fe6b912fca5 Jerome Glisse 2009-06-05 832 {
4c7886791264f0 Jerome Glisse 2009-11-20 833 int r;
4c7886791264f0 Jerome Glisse 2009-11-20 834
0a0c7596c64323 Jerome Glisse 2009-12-11 835 if (!rdev->mman.initialized)
0a0c7596c64323 Jerome Glisse 2009-12-11 836 return;
2014b5694182b5 Christian König 2013-12-18 837 radeon_ttm_debugfs_fini(rdev);
4aa5b92fd48f88 Kent Russell 2017-08-08 838 if (rdev->stolen_vga_memory) {
4aa5b92fd48f88 Kent Russell 2017-08-08 839 r = radeon_bo_reserve(rdev->stolen_vga_memory, false);
4c7886791264f0 Jerome Glisse 2009-11-20 840 if (r == 0) {
4aa5b92fd48f88 Kent Russell 2017-08-08 841 radeon_bo_unpin(rdev->stolen_vga_memory);
4aa5b92fd48f88 Kent Russell 2017-08-08 842 radeon_bo_unreserve(rdev->stolen_vga_memory);
4c7886791264f0 Jerome Glisse 2009-11-20 843 }
4aa5b92fd48f88 Kent Russell 2017-08-08 844 radeon_bo_unref(&rdev->stolen_vga_memory);
771fe6b912fca5 Jerome Glisse 2009-06-05 845 }
771fe6b912fca5 Jerome Glisse 2009-06-05 846 ttm_bo_clean_mm(&rdev->mman.bdev, TTM_PL_VRAM);
771fe6b912fca5 Jerome Glisse 2009-06-05 847 ttm_bo_clean_mm(&rdev->mman.bdev, TTM_PL_TT);
771fe6b912fca5 Jerome Glisse 2009-06-05 848 ttm_bo_device_release(&rdev->mman.bdev);
771fe6b912fca5 Jerome Glisse 2009-06-05 849 radeon_gart_fini(rdev);
0a0c7596c64323 Jerome Glisse 2009-12-11 850 rdev->mman.initialized = false;
771fe6b912fca5 Jerome Glisse 2009-06-05 851 DRM_INFO("radeon: ttm finalized\n");
771fe6b912fca5 Jerome Glisse 2009-06-05 852 }
771fe6b912fca5 Jerome Glisse 2009-06-05 853
5359533801e3dd Dave Airlie 2011-03-14 854 /* this should only be called at bootup or when userspace
5359533801e3dd Dave Airlie 2011-03-14 855 * isn't running */
5359533801e3dd Dave Airlie 2011-03-14 856 void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size)
5359533801e3dd Dave Airlie 2011-03-14 857 {
5359533801e3dd Dave Airlie 2011-03-14 858 struct ttm_mem_type_manager *man;
5359533801e3dd Dave Airlie 2011-03-14 859
5359533801e3dd Dave Airlie 2011-03-14 860 if (!rdev->mman.initialized)
5359533801e3dd Dave Airlie 2011-03-14 861 return;
5359533801e3dd Dave Airlie 2011-03-14 862
5359533801e3dd Dave Airlie 2011-03-14 863 man = &rdev->mman.bdev.man[TTM_PL_VRAM];
5359533801e3dd Dave Airlie 2011-03-14 864 /* this just adjusts TTM size idea, which sets lpfn to the correct value */
5359533801e3dd Dave Airlie 2011-03-14 865 man->size = size >> PAGE_SHIFT;
5359533801e3dd Dave Airlie 2011-03-14 866 }
5359533801e3dd Dave Airlie 2011-03-14 867
2bfb0b678e48de Souptick Joarder 2018-04-16 868 static vm_fault_t radeon_ttm_fault(struct vm_fault *vmf)
771fe6b912fca5 Jerome Glisse 2009-06-05 869 {
771fe6b912fca5 Jerome Glisse 2009-06-05 870 struct ttm_buffer_object *bo;
5876dd249e8e47 Matthew Garrett 2010-04-26 871 struct radeon_device *rdev;
2bfb0b678e48de Souptick Joarder 2018-04-16 872 vm_fault_t ret;
771fe6b912fca5 Jerome Glisse 2009-06-05 873
11bac80004499e Dave Jiang 2017-02-24 874 bo = (struct ttm_buffer_object *)vmf->vma->vm_private_data;
165d3448a1a0e8 Christian König 2019-09-27 875 if (bo == NULL)
771fe6b912fca5 Jerome Glisse 2009-06-05 876 return VM_FAULT_NOPAGE;
165d3448a1a0e8 Christian König 2019-09-27 877
5876dd249e8e47 Matthew Garrett 2010-04-26 878 rdev = radeon_get_rdev(bo->bdev);
db7fce3983ad9b Christian König 2012-05-11 879 down_read(&rdev->pm.mclk_lock);
165d3448a1a0e8 Christian König 2019-09-27 880 ret = ttm_bo_vm_fault(vmf);
db7fce3983ad9b Christian König 2012-05-11 881 up_read(&rdev->pm.mclk_lock);
2bfb0b678e48de Souptick Joarder 2018-04-16 882 return ret;
771fe6b912fca5 Jerome Glisse 2009-06-05 883 }
771fe6b912fca5 Jerome Glisse 2009-06-05 884
165d3448a1a0e8 Christian König 2019-09-27 885 static struct vm_operations_struct radeon_ttm_vm_ops = {
165d3448a1a0e8 Christian König 2019-09-27 886 .fault = radeon_ttm_fault,
165d3448a1a0e8 Christian König 2019-09-27 887 .open = ttm_bo_vm_open,
165d3448a1a0e8 Christian König 2019-09-27 888 .close = ttm_bo_vm_close,
165d3448a1a0e8 Christian König 2019-09-27 889 .access = ttm_bo_vm_access
165d3448a1a0e8 Christian König 2019-09-27 890 };
165d3448a1a0e8 Christian König 2019-09-27 891
771fe6b912fca5 Jerome Glisse 2009-06-05 892 int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
771fe6b912fca5 Jerome Glisse 2009-06-05 893 {
771fe6b912fca5 Jerome Glisse 2009-06-05 894 int r;
bed2dd84212eb0 Thomas Zimmermann 2019-02-07 895 struct drm_file *file_priv = filp->private_data;
bed2dd84212eb0 Thomas Zimmermann 2019-02-07 896 struct radeon_device *rdev = file_priv->minor->dev->dev_private;
771fe6b912fca5 Jerome Glisse 2009-06-05 897
165d3448a1a0e8 Christian König 2019-09-27 898 if (rdev == NULL)
771fe6b912fca5 Jerome Glisse 2009-06-05 899 return -EINVAL;
165d3448a1a0e8 Christian König 2019-09-27 900
771fe6b912fca5 Jerome Glisse 2009-06-05 901 r = ttm_bo_mmap(filp, vma, &rdev->mman.bdev);
165d3448a1a0e8 Christian König 2019-09-27 902 if (unlikely(r != 0))
771fe6b912fca5 Jerome Glisse 2009-06-05 903 return r;
165d3448a1a0e8 Christian König 2019-09-27 904
771fe6b912fca5 Jerome Glisse 2009-06-05 905 vma->vm_ops = &radeon_ttm_vm_ops;
771fe6b912fca5 Jerome Glisse 2009-06-05 906 return 0;
771fe6b912fca5 Jerome Glisse 2009-06-05 907 }
771fe6b912fca5 Jerome Glisse 2009-06-05 908
fa8a123855e200 Dave Airlie 2009-08-26 909 #if defined(CONFIG_DEBUG_FS)
893d6e6e122386 Christian König 2013-12-12 910
fa8a123855e200 Dave Airlie 2009-08-26 911 static int radeon_mm_dump_table(struct seq_file *m, void *data)
fa8a123855e200 Dave Airlie 2009-08-26 912 {
fa8a123855e200 Dave Airlie 2009-08-26 913 struct drm_info_node *node = (struct drm_info_node *)m->private;
893d6e6e122386 Christian König 2013-12-12 914 unsigned ttm_pl = *(int*)node->info_ent->data;
fa8a123855e200 Dave Airlie 2009-08-26 915 struct drm_device *dev = node->minor->dev;
fa8a123855e200 Dave Airlie 2009-08-26 916 struct radeon_device *rdev = dev->dev_private;
bbbb29efa20d55 Christian König 2017-08-07 917 struct ttm_mem_type_manager *man = &rdev->mman.bdev.man[ttm_pl];
b5c3714fe87897 Daniel Vetter 2016-12-29 918 struct drm_printer p = drm_seq_file_printer(m);
fa8a123855e200 Dave Airlie 2009-08-26 919
bbbb29efa20d55 Christian König 2017-08-07 920 man->func->debug(man, &p);
b5c3714fe87897 Daniel Vetter 2016-12-29 921 return 0;
fa8a123855e200 Dave Airlie 2009-08-26 922 }
893d6e6e122386 Christian König 2013-12-12 923
bbbb29efa20d55 Christian König 2017-08-07 924
893d6e6e122386 Christian König 2013-12-12 925 static int ttm_pl_vram = TTM_PL_VRAM;
893d6e6e122386 Christian König 2013-12-12 926 static int ttm_pl_tt = TTM_PL_TT;
893d6e6e122386 Christian König 2013-12-12 927
893d6e6e122386 Christian König 2013-12-12 928 static struct drm_info_list radeon_ttm_debugfs_list[] = {
893d6e6e122386 Christian König 2013-12-12 929 {"radeon_vram_mm", radeon_mm_dump_table, 0, &ttm_pl_vram},
893d6e6e122386 Christian König 2013-12-12 930 {"radeon_gtt_mm", radeon_mm_dump_table, 0, &ttm_pl_tt},
893d6e6e122386 Christian König 2013-12-12 931 {"ttm_page_pool", ttm_page_alloc_debugfs, 0, NULL},
893d6e6e122386 Christian König 2013-12-12 932 #ifdef CONFIG_SWIOTLB
893d6e6e122386 Christian König 2013-12-12 933 {"ttm_dma_page_pool", ttm_dma_page_alloc_debugfs, 0, NULL}
893d6e6e122386 Christian König 2013-12-12 934 #endif
893d6e6e122386 Christian König 2013-12-12 935 };
893d6e6e122386 Christian König 2013-12-12 936
2014b5694182b5 Christian König 2013-12-18 937 static int radeon_ttm_vram_open(struct inode *inode, struct file *filep)
2014b5694182b5 Christian König 2013-12-18 938 {
2014b5694182b5 Christian König 2013-12-18 939 struct radeon_device *rdev = inode->i_private;
2014b5694182b5 Christian König 2013-12-18 940 i_size_write(inode, rdev->mc.mc_vram_size);
2014b5694182b5 Christian König 2013-12-18 941 filep->private_data = inode->i_private;
2014b5694182b5 Christian König 2013-12-18 942 return 0;
2014b5694182b5 Christian König 2013-12-18 943 }
2014b5694182b5 Christian König 2013-12-18 944
2014b5694182b5 Christian König 2013-12-18 945 static ssize_t radeon_ttm_vram_read(struct file *f, char __user *buf,
2014b5694182b5 Christian König 2013-12-18 946 size_t size, loff_t *pos)
2014b5694182b5 Christian König 2013-12-18 947 {
2014b5694182b5 Christian König 2013-12-18 948 struct radeon_device *rdev = f->private_data;
2014b5694182b5 Christian König 2013-12-18 949 ssize_t result = 0;
2014b5694182b5 Christian König 2013-12-18 950 int r;
2014b5694182b5 Christian König 2013-12-18 951
2014b5694182b5 Christian König 2013-12-18 952 if (size & 0x3 || *pos & 0x3)
2014b5694182b5 Christian König 2013-12-18 953 return -EINVAL;
2014b5694182b5 Christian König 2013-12-18 954
2014b5694182b5 Christian König 2013-12-18 955 while (size) {
2014b5694182b5 Christian König 2013-12-18 956 unsigned long flags;
2014b5694182b5 Christian König 2013-12-18 957 uint32_t value;
2014b5694182b5 Christian König 2013-12-18 958
2014b5694182b5 Christian König 2013-12-18 959 if (*pos >= rdev->mc.mc_vram_size)
2014b5694182b5 Christian König 2013-12-18 960 return result;
2014b5694182b5 Christian König 2013-12-18 961
2014b5694182b5 Christian König 2013-12-18 962 spin_lock_irqsave(&rdev->mmio_idx_lock, flags);
2014b5694182b5 Christian König 2013-12-18 963 WREG32(RADEON_MM_INDEX, ((uint32_t)*pos) | 0x80000000);
2014b5694182b5 Christian König 2013-12-18 964 if (rdev->family >= CHIP_CEDAR)
2014b5694182b5 Christian König 2013-12-18 965 WREG32(EVERGREEN_MM_INDEX_HI, *pos >> 31);
2014b5694182b5 Christian König 2013-12-18 966 value = RREG32(RADEON_MM_DATA);
2014b5694182b5 Christian König 2013-12-18 967 spin_unlock_irqrestore(&rdev->mmio_idx_lock, flags);
2014b5694182b5 Christian König 2013-12-18 968
2014b5694182b5 Christian König 2013-12-18 @969 r = put_user(value, (uint32_t *)buf);
2014b5694182b5 Christian König 2013-12-18 970 if (r)
2014b5694182b5 Christian König 2013-12-18 971 return r;
2014b5694182b5 Christian König 2013-12-18 972
2014b5694182b5 Christian König 2013-12-18 973 result += 4;
2014b5694182b5 Christian König 2013-12-18 974 buf += 4;
2014b5694182b5 Christian König 2013-12-18 975 *pos += 4;
2014b5694182b5 Christian König 2013-12-18 976 size -= 4;
2014b5694182b5 Christian König 2013-12-18 977 }
2014b5694182b5 Christian König 2013-12-18 978
2014b5694182b5 Christian König 2013-12-18 979 return result;
2014b5694182b5 Christian König 2013-12-18 980 }
2014b5694182b5 Christian König 2013-12-18 981

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip