drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device_queue_manager.c:172:15: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Sat Aug 22 2020 - 12:04:56 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f873db9acd3c92d4741bc3676c9eb511b2f9a6f6
commit: 9555152beb1143c85c03f9b9de59863cbbe89f4b Merge tag 'amd-drm-next-5.9-2020-07-01' of git://people.freedesktop.org/~agd5f/linux into drm-next
date: 7 weeks ago
config: arm64-randconfig-s031-20200821 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
git checkout 9555152beb1143c85c03f9b9de59863cbbe89f4b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64

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/amd/amdgpu/../amdkfd/kfd_device_queue_manager.c:172:15: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned long long [noderef] __user *__p @@ got unsigned long long [usertype] * @@
>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device_queue_manager.c:172:15: sparse: expected unsigned long long [noderef] __user *__p
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device_queue_manager.c:172:15: sparse: got unsigned long long [usertype] *

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9555152beb1143c85c03f9b9de59863cbbe89f4b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 9555152beb1143c85c03f9b9de59863cbbe89f4b
vim +172 drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device_queue_manager.c

b42902f4af8fec Yong Zhao 2020-02-05 155
d69fd951e60ae4 Mukul Joshi 2020-06-24 156 int read_sdma_queue_counter(uint64_t q_rptr, uint64_t *val)
32cb59f3136248 Mukul Joshi 2020-05-26 157 {
32cb59f3136248 Mukul Joshi 2020-05-26 158 int ret;
32cb59f3136248 Mukul Joshi 2020-05-26 159 uint64_t tmp = 0;
32cb59f3136248 Mukul Joshi 2020-05-26 160
d69fd951e60ae4 Mukul Joshi 2020-06-24 161 if (!val)
32cb59f3136248 Mukul Joshi 2020-05-26 162 return -EINVAL;
32cb59f3136248 Mukul Joshi 2020-05-26 163 /*
32cb59f3136248 Mukul Joshi 2020-05-26 164 * SDMA activity counter is stored at queue's RPTR + 0x8 location.
32cb59f3136248 Mukul Joshi 2020-05-26 165 */
d69fd951e60ae4 Mukul Joshi 2020-06-24 166 if (!access_ok((const void __user *)(q_rptr +
32cb59f3136248 Mukul Joshi 2020-05-26 167 sizeof(uint64_t)), sizeof(uint64_t))) {
32cb59f3136248 Mukul Joshi 2020-05-26 168 pr_err("Can't access sdma queue activity counter\n");
32cb59f3136248 Mukul Joshi 2020-05-26 169 return -EFAULT;
32cb59f3136248 Mukul Joshi 2020-05-26 170 }
32cb59f3136248 Mukul Joshi 2020-05-26 171
d69fd951e60ae4 Mukul Joshi 2020-06-24 @172 ret = get_user(tmp, (uint64_t *)(q_rptr + sizeof(uint64_t)));
32cb59f3136248 Mukul Joshi 2020-05-26 173 if (!ret) {
32cb59f3136248 Mukul Joshi 2020-05-26 174 *val = tmp;
32cb59f3136248 Mukul Joshi 2020-05-26 175 }
32cb59f3136248 Mukul Joshi 2020-05-26 176
32cb59f3136248 Mukul Joshi 2020-05-26 177 return ret;
32cb59f3136248 Mukul Joshi 2020-05-26 178 }
32cb59f3136248 Mukul Joshi 2020-05-26 179

:::::: The code at line 172 was first introduced by commit
:::::: d69fd951e60ae48c8dd100aa8ceb799ab965f9b3 drm/amdkfd: Fix circular locking dependency warning

:::::: TO: Mukul Joshi <mukul.joshi@xxxxxxx>
:::::: CC: Alex Deucher <alexander.deucher@xxxxxxx>

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

Attachment: .config.gz
Description: application/gzip