Re: [linux-next:master 10767/11658] drivers/staging/wlan-ng/p80211netdev.c:572:33: sparse: sparse: incorrect type in argument 1 (different address spaces)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/18/21 11:55 AM, kernel test robot wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   cd560d8023bf73c94d755908c8d4a0994dd1ec34
commit: bc4bf94cc2aed9192184782dbb9f884c5d6b9e82 [10767/11658] staging:wlan-ng: use memdup_user instead of kmalloc/copy_from_user
config: i386-randconfig-s001-20210218 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
         # apt-get install sparse
         # sparse version: v0.6.3-215-g0fb77bb6-dirty
         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=bc4bf94cc2aed9192184782dbb9f884c5d6b9e82
         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
         git fetch --no-tags linux-next master
         git checkout bc4bf94cc2aed9192184782dbb9f884c5d6b9e82
         # save the attached .config to linux build tree
         make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

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


Greg, should I fix my patch?

Pritthijit Nath <pritthijit.nath at icloud.com> has already made a fix for this warning:
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2021-February/150785.html


"sparse warnings: (new ones prefixed by >>)"
drivers/staging/wlan-ng/p80211netdev.c:572:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __user * @@     got char *[usertype] data @@
    drivers/staging/wlan-ng/p80211netdev.c:572:33: sparse:     expected void const [noderef] __user *
    drivers/staging/wlan-ng/p80211netdev.c:572:33: sparse:     got char *[usertype] data

vim +572 drivers/staging/wlan-ng/p80211netdev.c

    557	
    558		/* Test the magic, assume ifr is good if it's there */
    559		if (req->magic != P80211_IOCTL_MAGIC) {
    560			result = -EINVAL;
    561			goto bail;
    562		}
    563	
    564		if (cmd == P80211_IFTEST) {
    565			result = 0;
    566			goto bail;
    567		} else if (cmd != P80211_IFREQ) {
    568			result = -EINVAL;
    569			goto bail;
    570		}
    571	
  > 572		msgbuf = memdup_user(req->data, req->len);
    573		if (IS_ERR(msgbuf)) {
    574			result = PTR_ERR(msgbuf);
    575			goto bail;
    576		}
    577	
    578		result = p80211req_dorequest(wlandev, msgbuf);
    579	
    580		if (result == 0) {
    581			if (copy_to_user
    582			    ((void __user *)req->data, msgbuf, req->len)) {
    583				result = -EFAULT;
    584			}
    585		}
    586		kfree(msgbuf);
    587	
    588	bail:
    589		/* If allocate,copyfrom or copyto fails, return errno */
    590		return result;
    591	}
    592	

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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux