lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202102041953.5IcqQDPm-lkp@intel.com>
Date:   Thu, 4 Feb 2021 19:41:57 +0800
From:   kernel test robot <lkp@...el.com>
To:     Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Subject: drivers/staging/greybus/fw-management.c:493:21: sparse: sparse:
 incorrect type in argument 1 (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   61556703b610a104de324e4f061dc6cf7b218b46
commit: e5fc436f06eef54ef512ea55a9db8eb9f2e76959 sparse: use static inline for __chk_{user,io}_ptr()
date:   5 months ago
config: sh-randconfig-s031-20210204 (attached as .config)
compiler: sh4-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.3-215-g0fb77bb6-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5fc436f06eef54ef512ea55a9db8eb9f2e76959
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e5fc436f06eef54ef512ea55a9db8eb9f2e76959
        # 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=sh 

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


"sparse warnings: (new ones prefixed by >>)"
   drivers/staging/greybus/fw-management.c:493:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int const *__gu_addr @@     got unsigned int [noderef] __user * @@
   drivers/staging/greybus/fw-management.c:493:21: sparse:     expected unsigned int const *__gu_addr
   drivers/staging/greybus/fw-management.c:493:21: sparse:     got unsigned int [noderef] __user *
>> drivers/staging/greybus/fw-management.c:493:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned int const *__gu_addr @@
   drivers/staging/greybus/fw-management.c:493:21: sparse:     expected void const volatile [noderef] __user *ptr
   drivers/staging/greybus/fw-management.c:493:21: sparse:     got unsigned int const *__gu_addr
--
   sound/core/oss/pcm_oss.c:884:53: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected int format @@     got restricted snd_pcm_format_t [assigned] [usertype] format @@
   sound/core/oss/pcm_oss.c:884:53: sparse:     expected int format
   sound/core/oss/pcm_oss.c:884:53: sparse:     got restricted snd_pcm_format_t [assigned] [usertype] format
   sound/core/oss/pcm_oss.c:884:25: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted snd_pcm_format_t [assigned] [usertype] sformat @@     got int @@
   sound/core/oss/pcm_oss.c:884:25: sparse:     expected restricted snd_pcm_format_t [assigned] [usertype] sformat
   sound/core/oss/pcm_oss.c:884:25: sparse:     got int
   sound/core/oss/pcm_oss.c:2592:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *p @@
   sound/core/oss/pcm_oss.c:2592:21: sparse:     expected int const *__gu_addr
   sound/core/oss/pcm_oss.c:2592:21: sparse:     got int [noderef] __user *p
>> sound/core/oss/pcm_oss.c:2592:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   sound/core/oss/pcm_oss.c:2592:21: sparse:     expected void const volatile [noderef] __user *ptr
   sound/core/oss/pcm_oss.c:2592:21: sparse:     got int const *__gu_addr
   sound/core/oss/pcm_oss.c:2603:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *p @@
   sound/core/oss/pcm_oss.c:2603:21: sparse:     expected int const *__gu_addr
   sound/core/oss/pcm_oss.c:2603:21: sparse:     got int [noderef] __user *p
   sound/core/oss/pcm_oss.c:2603:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   sound/core/oss/pcm_oss.c:2603:21: sparse:     expected void const volatile [noderef] __user *ptr
   sound/core/oss/pcm_oss.c:2603:21: sparse:     got int const *__gu_addr
   sound/core/oss/pcm_oss.c:2615:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *p @@
   sound/core/oss/pcm_oss.c:2615:21: sparse:     expected int const *__gu_addr
   sound/core/oss/pcm_oss.c:2615:21: sparse:     got int [noderef] __user *p
   sound/core/oss/pcm_oss.c:2615:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   sound/core/oss/pcm_oss.c:2615:21: sparse:     expected void const volatile [noderef] __user *ptr
   sound/core/oss/pcm_oss.c:2615:21: sparse:     got int const *__gu_addr
   sound/core/oss/pcm_oss.c:2627:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *p @@
   sound/core/oss/pcm_oss.c:2627:21: sparse:     expected int const *__gu_addr
   sound/core/oss/pcm_oss.c:2627:21: sparse:     got int [noderef] __user *p
   sound/core/oss/pcm_oss.c:2627:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   sound/core/oss/pcm_oss.c:2627:21: sparse:     expected void const volatile [noderef] __user *ptr
   sound/core/oss/pcm_oss.c:2627:21: sparse:     got int const *__gu_addr
   sound/core/oss/pcm_oss.c:2644:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *p @@
   sound/core/oss/pcm_oss.c:2644:21: sparse:     expected int const *__gu_addr
   sound/core/oss/pcm_oss.c:2644:21: sparse:     got int [noderef] __user *p
   sound/core/oss/pcm_oss.c:2644:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   sound/core/oss/pcm_oss.c:2644:21: sparse:     expected void const volatile [noderef] __user *ptr
   sound/core/oss/pcm_oss.c:2644:21: sparse:     got int const *__gu_addr
   sound/core/oss/pcm_oss.c:2651:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *p @@
   sound/core/oss/pcm_oss.c:2651:21: sparse:     expected int const *__gu_addr
   sound/core/oss/pcm_oss.c:2651:21: sparse:     got int [noderef] __user *p
   sound/core/oss/pcm_oss.c:2651:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   sound/core/oss/pcm_oss.c:2651:21: sparse:     expected void const volatile [noderef] __user *ptr
   sound/core/oss/pcm_oss.c:2651:21: sparse:     got int const *__gu_addr
   sound/core/oss/pcm_oss.c:2678:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *p @@
   sound/core/oss/pcm_oss.c:2678:21: sparse:     expected int const *__gu_addr
   sound/core/oss/pcm_oss.c:2678:21: sparse:     got int [noderef] __user *p
   sound/core/oss/pcm_oss.c:2678:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   sound/core/oss/pcm_oss.c:2678:21: sparse:     expected void const volatile [noderef] __user *ptr
   sound/core/oss/pcm_oss.c:2678:21: sparse:     got int const *__gu_addr

vim +493 drivers/staging/greybus/fw-management.c

96ba6740099b1f Viresh Kumar 2016-05-14  406  
013e665372733f Viresh Kumar 2016-05-14  407  static int fw_mgmt_ioctl(struct fw_mgmt *fw_mgmt, unsigned int cmd,
013e665372733f Viresh Kumar 2016-05-14  408  			 void __user *buf)
013e665372733f Viresh Kumar 2016-05-14  409  {
5e10f0047a1b79 Viresh Kumar 2016-07-25  410  	struct fw_mgmt_ioc_get_intf_version intf_fw_info;
5e10f0047a1b79 Viresh Kumar 2016-07-25  411  	struct fw_mgmt_ioc_get_backend_version backend_fw_info;
013e665372733f Viresh Kumar 2016-05-14  412  	struct fw_mgmt_ioc_intf_load_and_validate intf_load;
013e665372733f Viresh Kumar 2016-05-14  413  	struct fw_mgmt_ioc_backend_fw_update backend_update;
013e665372733f Viresh Kumar 2016-05-14  414  	unsigned int timeout;
013e665372733f Viresh Kumar 2016-05-14  415  	int ret;
013e665372733f Viresh Kumar 2016-05-14  416  
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  417  	/* Reject any operations after mode-switch has started */
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  418  	if (fw_mgmt->mode_switch_started)
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  419  		return -EBUSY;
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  420  
013e665372733f Viresh Kumar 2016-05-14  421  	switch (cmd) {
013e665372733f Viresh Kumar 2016-05-14  422  	case FW_MGMT_IOC_GET_INTF_FW:
5e10f0047a1b79 Viresh Kumar 2016-07-25  423  		ret = fw_mgmt_interface_fw_version_operation(fw_mgmt,
5e10f0047a1b79 Viresh Kumar 2016-07-25  424  							     &intf_fw_info);
013e665372733f Viresh Kumar 2016-05-14  425  		if (ret)
013e665372733f Viresh Kumar 2016-05-14  426  			return ret;
013e665372733f Viresh Kumar 2016-05-14  427  
5e10f0047a1b79 Viresh Kumar 2016-07-25  428  		if (copy_to_user(buf, &intf_fw_info, sizeof(intf_fw_info)))
013e665372733f Viresh Kumar 2016-05-14  429  			return -EFAULT;
013e665372733f Viresh Kumar 2016-05-14  430  
013e665372733f Viresh Kumar 2016-05-14  431  		return 0;
013e665372733f Viresh Kumar 2016-05-14  432  	case FW_MGMT_IOC_GET_BACKEND_FW:
5e10f0047a1b79 Viresh Kumar 2016-07-25  433  		if (copy_from_user(&backend_fw_info, buf,
5e10f0047a1b79 Viresh Kumar 2016-07-25  434  				   sizeof(backend_fw_info)))
013e665372733f Viresh Kumar 2016-05-14  435  			return -EFAULT;
013e665372733f Viresh Kumar 2016-05-14  436  
5e10f0047a1b79 Viresh Kumar 2016-07-25  437  		ret = fw_mgmt_backend_fw_version_operation(fw_mgmt,
5e10f0047a1b79 Viresh Kumar 2016-07-25  438  							   &backend_fw_info);
013e665372733f Viresh Kumar 2016-05-14  439  		if (ret)
013e665372733f Viresh Kumar 2016-05-14  440  			return ret;
013e665372733f Viresh Kumar 2016-05-14  441  
5e10f0047a1b79 Viresh Kumar 2016-07-25  442  		if (copy_to_user(buf, &backend_fw_info,
5e10f0047a1b79 Viresh Kumar 2016-07-25  443  				 sizeof(backend_fw_info)))
013e665372733f Viresh Kumar 2016-05-14  444  			return -EFAULT;
013e665372733f Viresh Kumar 2016-05-14  445  
013e665372733f Viresh Kumar 2016-05-14  446  		return 0;
013e665372733f Viresh Kumar 2016-05-14  447  	case FW_MGMT_IOC_INTF_LOAD_AND_VALIDATE:
013e665372733f Viresh Kumar 2016-05-14  448  		if (copy_from_user(&intf_load, buf, sizeof(intf_load)))
013e665372733f Viresh Kumar 2016-05-14  449  			return -EFAULT;
013e665372733f Viresh Kumar 2016-05-14  450  
013e665372733f Viresh Kumar 2016-05-14  451  		ret = fw_mgmt_load_and_validate_operation(fw_mgmt,
013e665372733f Viresh Kumar 2016-05-14  452  				intf_load.load_method, intf_load.firmware_tag);
013e665372733f Viresh Kumar 2016-05-14  453  		if (ret)
013e665372733f Viresh Kumar 2016-05-14  454  			return ret;
013e665372733f Viresh Kumar 2016-05-14  455  
013e665372733f Viresh Kumar 2016-05-14  456  		if (!wait_for_completion_timeout(&fw_mgmt->completion,
013e665372733f Viresh Kumar 2016-05-14  457  						 fw_mgmt->timeout_jiffies)) {
013e665372733f Viresh Kumar 2016-05-14  458  			dev_err(fw_mgmt->parent, "timed out waiting for firmware load and validation to finish\n");
013e665372733f Viresh Kumar 2016-05-14  459  			return -ETIMEDOUT;
013e665372733f Viresh Kumar 2016-05-14  460  		}
013e665372733f Viresh Kumar 2016-05-14  461  
013e665372733f Viresh Kumar 2016-05-14  462  		intf_load.status = fw_mgmt->intf_fw_status;
79b140fe2b6f2d Viresh Kumar 2016-05-16  463  		intf_load.major = fw_mgmt->intf_fw_major;
79b140fe2b6f2d Viresh Kumar 2016-05-16  464  		intf_load.minor = fw_mgmt->intf_fw_minor;
013e665372733f Viresh Kumar 2016-05-14  465  
013e665372733f Viresh Kumar 2016-05-14  466  		if (copy_to_user(buf, &intf_load, sizeof(intf_load)))
013e665372733f Viresh Kumar 2016-05-14  467  			return -EFAULT;
013e665372733f Viresh Kumar 2016-05-14  468  
013e665372733f Viresh Kumar 2016-05-14  469  		return 0;
013e665372733f Viresh Kumar 2016-05-14  470  	case FW_MGMT_IOC_INTF_BACKEND_FW_UPDATE:
013e665372733f Viresh Kumar 2016-05-14  471  		if (copy_from_user(&backend_update, buf,
013e665372733f Viresh Kumar 2016-05-14  472  				   sizeof(backend_update)))
013e665372733f Viresh Kumar 2016-05-14  473  			return -EFAULT;
013e665372733f Viresh Kumar 2016-05-14  474  
013e665372733f Viresh Kumar 2016-05-14  475  		ret = fw_mgmt_backend_fw_update_operation(fw_mgmt,
013e665372733f Viresh Kumar 2016-05-14  476  				backend_update.firmware_tag);
013e665372733f Viresh Kumar 2016-05-14  477  		if (ret)
013e665372733f Viresh Kumar 2016-05-14  478  			return ret;
013e665372733f Viresh Kumar 2016-05-14  479  
013e665372733f Viresh Kumar 2016-05-14  480  		if (!wait_for_completion_timeout(&fw_mgmt->completion,
013e665372733f Viresh Kumar 2016-05-14  481  						 fw_mgmt->timeout_jiffies)) {
013e665372733f Viresh Kumar 2016-05-14  482  			dev_err(fw_mgmt->parent, "timed out waiting for backend firmware update to finish\n");
013e665372733f Viresh Kumar 2016-05-14  483  			return -ETIMEDOUT;
013e665372733f Viresh Kumar 2016-05-14  484  		}
013e665372733f Viresh Kumar 2016-05-14  485  
013e665372733f Viresh Kumar 2016-05-14  486  		backend_update.status = fw_mgmt->backend_fw_status;
013e665372733f Viresh Kumar 2016-05-14  487  
013e665372733f Viresh Kumar 2016-05-14  488  		if (copy_to_user(buf, &backend_update, sizeof(backend_update)))
013e665372733f Viresh Kumar 2016-05-14  489  			return -EFAULT;
013e665372733f Viresh Kumar 2016-05-14  490  
013e665372733f Viresh Kumar 2016-05-14  491  		return 0;
013e665372733f Viresh Kumar 2016-05-14  492  	case FW_MGMT_IOC_SET_TIMEOUT_MS:
013e665372733f Viresh Kumar 2016-05-14 @493  		if (get_user(timeout, (unsigned int __user *)buf))
013e665372733f Viresh Kumar 2016-05-14  494  			return -EFAULT;
013e665372733f Viresh Kumar 2016-05-14  495  
013e665372733f Viresh Kumar 2016-05-14  496  		if (!timeout) {
013e665372733f Viresh Kumar 2016-05-14  497  			dev_err(fw_mgmt->parent, "timeout can't be zero\n");
013e665372733f Viresh Kumar 2016-05-14  498  			return -EINVAL;
013e665372733f Viresh Kumar 2016-05-14  499  		}
013e665372733f Viresh Kumar 2016-05-14  500  
013e665372733f Viresh Kumar 2016-05-14  501  		fw_mgmt->timeout_jiffies = msecs_to_jiffies(timeout);
013e665372733f Viresh Kumar 2016-05-14  502  
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  503  		return 0;
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  504  	case FW_MGMT_IOC_MODE_SWITCH:
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  505  		if (!fw_mgmt->intf_fw_loaded) {
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  506  			dev_err(fw_mgmt->parent,
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  507  				"Firmware not loaded for mode-switch\n");
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  508  			return -EPERM;
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  509  		}
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  510  
68ee90c29ea406 Viresh Kumar 2016-05-30  511  		/*
68ee90c29ea406 Viresh Kumar 2016-05-30  512  		 * Disallow new ioctls as the fw-core bundle driver is going to
68ee90c29ea406 Viresh Kumar 2016-05-30  513  		 * get disconnected soon and the character device will get
68ee90c29ea406 Viresh Kumar 2016-05-30  514  		 * removed.
68ee90c29ea406 Viresh Kumar 2016-05-30  515  		 */
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  516  		fw_mgmt->mode_switch_started = true;
04f0e6ebd1a2ca Viresh Kumar 2016-05-14  517  
c92c1d026b1e13 Viresh Kumar 2016-05-30  518  		ret = gb_interface_request_mode_switch(fw_mgmt->connection->intf);
c92c1d026b1e13 Viresh Kumar 2016-05-30  519  		if (ret) {
c92c1d026b1e13 Viresh Kumar 2016-05-30  520  			dev_err(fw_mgmt->parent, "Mode-switch failed: %d\n",
c92c1d026b1e13 Viresh Kumar 2016-05-30  521  				ret);
c92c1d026b1e13 Viresh Kumar 2016-05-30  522  			fw_mgmt->mode_switch_started = false;
c92c1d026b1e13 Viresh Kumar 2016-05-30  523  			return ret;
c92c1d026b1e13 Viresh Kumar 2016-05-30  524  		}
c92c1d026b1e13 Viresh Kumar 2016-05-30  525  
013e665372733f Viresh Kumar 2016-05-14  526  		return 0;
013e665372733f Viresh Kumar 2016-05-14  527  	default:
013e665372733f Viresh Kumar 2016-05-14  528  		return -ENOTTY;
013e665372733f Viresh Kumar 2016-05-14  529  	}
013e665372733f Viresh Kumar 2016-05-14  530  }
013e665372733f Viresh Kumar 2016-05-14  531  

:::::: The code at line 493 was first introduced by commit
:::::: 013e665372733fafd08599f0fc58ff5f450e4694 greybus: fw-management: Add firmware-management protocol driver

:::::: TO: Viresh Kumar <viresh.kumar@...aro.org>
:::::: CC: Greg Kroah-Hartman <gregkh@...gle.com>

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

Download attachment ".config.gz" of type "application/gzip" (24733 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ