drivers/staging/r8188eu/os_dep/ioctl_linux.c:3431:31: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Wed Apr 27 2022 - 13:48:49 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 46cf2c613f4b10eb12f749207b0fd2c1bfae3088
commit: 0a2b782a00f33e7d06dc43d099fa071ae97bee77 fortify: Make pointer arguments const
date: 2 months ago
config: mips-randconfig-s032-20220427 (https://download.01.org/0day-ci/archive/20220428/202204280108.t15hLKmX-lkp@xxxxxxxxx/config)
compiler: mips-linux-gcc (GCC) 11.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.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0a2b782a00f33e7d06dc43d099fa071ae97bee77
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 0a2b782a00f33e7d06dc43d099fa071ae97bee77
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash drivers/staging/r8188eu/

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


sparse warnings: (new ones prefixed by >>)
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3430:17: sparse: sparse: cast removes address space '__user' of expression
>> drivers/staging/r8188eu/os_dep/ioctl_linux.c:3431:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *const p @@ got void [noderef] __user *pointer @@
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3431:31: sparse: expected void const *const p
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3431:31: sparse: got void [noderef] __user *pointer
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3433:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *const p @@ got void [noderef] __user *pointer @@
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3433:38: sparse: expected void const *const p
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3433:38: sparse: got void [noderef] __user *pointer
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3435:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *const p @@ got void [noderef] __user *pointer @@
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3435:38: sparse: expected void const *const p
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3435:38: sparse: got void [noderef] __user *pointer
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3437:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *const p @@ got void [noderef] __user *pointer @@
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3437:38: sparse: expected void const *const p
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3437:38: sparse: got void [noderef] __user *pointer
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3439:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *const p @@ got void [noderef] __user *pointer @@
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3439:38: sparse: expected void const *const p
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3439:38: sparse: got void [noderef] __user *pointer
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3442:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *const p @@ got void [noderef] __user *pointer @@
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3442:38: sparse: expected void const *const p
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3442:38: sparse: got void [noderef] __user *pointer
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3444:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *const p @@ got void [noderef] __user *pointer @@
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3444:38: sparse: expected void const *const p
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3444:38: sparse: got void [noderef] __user *pointer
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3447:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *const p @@ got void [noderef] __user *pointer @@
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3447:38: sparse: expected void const *const p
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3447:38: sparse: got void [noderef] __user *pointer
drivers/staging/r8188eu/os_dep/ioctl_linux.c:3459:9: sparse: sparse: cast removes address space '__user' of expression

vim +3431 drivers/staging/r8188eu/os_dep/ioctl_linux.c

2b42bd58b32155 Phillip Potter 2021-07-28 3420
2b42bd58b32155 Phillip Potter 2021-07-28 3421 static int rtw_p2p_get(struct net_device *dev,
2b42bd58b32155 Phillip Potter 2021-07-28 3422 struct iw_request_info *info,
2b42bd58b32155 Phillip Potter 2021-07-28 3423 union iwreq_data *wrqu, char *extra)
2b42bd58b32155 Phillip Potter 2021-07-28 3424 {
2b42bd58b32155 Phillip Potter 2021-07-28 3425 int ret = 0;
2b42bd58b32155 Phillip Potter 2021-07-28 3426
2b42bd58b32155 Phillip Potter 2021-07-28 3427 struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
2b42bd58b32155 Phillip Potter 2021-07-28 3428
2b42bd58b32155 Phillip Potter 2021-07-28 3429 if (padapter->bShowGetP2PState)
2b42bd58b32155 Phillip Potter 2021-07-28 @3430 DBG_88E("[%s] extra = %s\n", __func__, (char *)wrqu->data.pointer);
2b42bd58b32155 Phillip Potter 2021-07-28 @3431 if (!memcmp(wrqu->data.pointer, "status", 6)) {
2b42bd58b32155 Phillip Potter 2021-07-28 3432 rtw_p2p_get_status(dev, info, wrqu, extra);
2b42bd58b32155 Phillip Potter 2021-07-28 3433 } else if (!memcmp(wrqu->data.pointer, "role", 4)) {
2b42bd58b32155 Phillip Potter 2021-07-28 3434 rtw_p2p_get_role(dev, info, wrqu, extra);
2b42bd58b32155 Phillip Potter 2021-07-28 3435 } else if (!memcmp(wrqu->data.pointer, "peer_ifa", 8)) {
2b42bd58b32155 Phillip Potter 2021-07-28 3436 rtw_p2p_get_peer_ifaddr(dev, info, wrqu, extra);
2b42bd58b32155 Phillip Potter 2021-07-28 3437 } else if (!memcmp(wrqu->data.pointer, "req_cm", 6)) {
2b42bd58b32155 Phillip Potter 2021-07-28 3438 rtw_p2p_get_req_cm(dev, info, wrqu, extra);
2b42bd58b32155 Phillip Potter 2021-07-28 3439 } else if (!memcmp(wrqu->data.pointer, "peer_deva", 9)) {
2b42bd58b32155 Phillip Potter 2021-07-28 3440 /* Get the P2P device address when receiving the provision discovery request frame. */
2b42bd58b32155 Phillip Potter 2021-07-28 3441 rtw_p2p_get_peer_devaddr(dev, info, wrqu, extra);
2b42bd58b32155 Phillip Potter 2021-07-28 3442 } else if (!memcmp(wrqu->data.pointer, "group_id", 8)) {
2b42bd58b32155 Phillip Potter 2021-07-28 3443 rtw_p2p_get_groupid(dev, info, wrqu, extra);
2b42bd58b32155 Phillip Potter 2021-07-28 3444 } else if (!memcmp(wrqu->data.pointer, "peer_deva_inv", 9)) {
2b42bd58b32155 Phillip Potter 2021-07-28 3445 /* Get the P2P device address when receiving the P2P Invitation request frame. */
2b42bd58b32155 Phillip Potter 2021-07-28 3446 rtw_p2p_get_peer_devaddr_by_invitation(dev, info, wrqu, extra);
2b42bd58b32155 Phillip Potter 2021-07-28 3447 } else if (!memcmp(wrqu->data.pointer, "op_ch", 5)) {
2b42bd58b32155 Phillip Potter 2021-07-28 3448 rtw_p2p_get_op_ch(dev, info, wrqu, extra);
2b42bd58b32155 Phillip Potter 2021-07-28 3449 }
2b42bd58b32155 Phillip Potter 2021-07-28 3450 return ret;
2b42bd58b32155 Phillip Potter 2021-07-28 3451 }
2b42bd58b32155 Phillip Potter 2021-07-28 3452

:::::: The code at line 3431 was first introduced by commit
:::::: 2b42bd58b32155a1be4dd78991845dec05aaef9e staging: r8188eu: introduce new os_dep dir for RTL8188eu driver

:::::: TO: Phillip Potter <phil@xxxxxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp