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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 27 Dec 2020 03:29:11 +0800
From:   kernel test robot <lkp@...el.com>
To:     Oliver Hartkopp <socketcan@...tkopp.net>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Marc Kleine-Budde <mkl@...gutronix.de>
Subject: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in
 initializer (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f838f8d2b694cf9d524dc4423e9dd2db13892f3f
commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
date:   3 months ago
config: sh-randconfig-s032-20201225 (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-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e057dd3fc20ffb3d7f150af46542a51b59b90127
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e057dd3fc20ffb3d7f150af46542a51b59b90127
        # 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 >>)"
>> net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user *optlen @@
   net/can/isotp.c:1240:13: sparse:     expected int const *__gu_addr
   net/can/isotp.c:1240:13: sparse:     got int [noderef] __user *optlen
>> net/can/isotp.c:1240:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   net/can/isotp.c:1240:13: sparse:     expected void const volatile [noderef] __user *ptr
   net/can/isotp.c:1240:13: sparse:     got int const *__gu_addr

vim +1240 net/can/isotp.c

  1229	
  1230	static int isotp_getsockopt(struct socket *sock, int level, int optname,
  1231				    char __user *optval, int __user *optlen)
  1232	{
  1233		struct sock *sk = sock->sk;
  1234		struct isotp_sock *so = isotp_sk(sk);
  1235		int len;
  1236		void *val;
  1237	
  1238		if (level != SOL_CAN_ISOTP)
  1239			return -EINVAL;
> 1240		if (get_user(len, optlen))
  1241			return -EFAULT;
  1242		if (len < 0)
  1243			return -EINVAL;
  1244	
  1245		switch (optname) {
  1246		case CAN_ISOTP_OPTS:
  1247			len = min_t(int, len, sizeof(struct can_isotp_options));
  1248			val = &so->opt;
  1249			break;
  1250	
  1251		case CAN_ISOTP_RECV_FC:
  1252			len = min_t(int, len, sizeof(struct can_isotp_fc_options));
  1253			val = &so->rxfc;
  1254			break;
  1255	
  1256		case CAN_ISOTP_TX_STMIN:
  1257			len = min_t(int, len, sizeof(u32));
  1258			val = &so->force_tx_stmin;
  1259			break;
  1260	
  1261		case CAN_ISOTP_RX_STMIN:
  1262			len = min_t(int, len, sizeof(u32));
  1263			val = &so->force_rx_stmin;
  1264			break;
  1265	
  1266		case CAN_ISOTP_LL_OPTS:
  1267			len = min_t(int, len, sizeof(struct can_isotp_ll_options));
  1268			val = &so->ll;
  1269			break;
  1270	
  1271		default:
  1272			return -ENOPROTOOPT;
  1273		}
  1274	
  1275		if (put_user(len, optlen))
  1276			return -EFAULT;
  1277		if (copy_to_user(optval, val, len))
  1278			return -EFAULT;
  1279		return 0;
  1280	}
  1281	

---
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" (21119 bytes)

Powered by blists - more mailing lists