* net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2020-10-28 23:01 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-10-28 23:01 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: kbuild-all, linux-kernel, Marc Kleine-Budde
[-- Attachment #1: Type: text/plain, Size: 3488 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 23859ae44402f4d935b9ee548135dd1e65e2cbf4
commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
date: 3 weeks ago
config: sh-randconfig-s031-20201028 (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-56-gc09e8239-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@intel.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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 23373 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2020-10-28 23:01 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-10-28 23:01 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3579 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 23859ae44402f4d935b9ee548135dd1e65e2cbf4
commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
date: 3 weeks ago
config: sh-randconfig-s031-20201028 (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-56-gc09e8239-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@intel.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(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 23373 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
2020-10-28 23:01 ` kernel test robot
@ 2020-10-29 7:33 ` Marc Kleine-Budde
-1 siblings, 0 replies; 16+ messages in thread
From: Marc Kleine-Budde @ 2020-10-29 7:33 UTC (permalink / raw)
To: kernel test robot, Oliver Hartkopp
Cc: kbuild-all, linux-kernel, Rich Felker, Yoshinori Sato
[-- Attachment #1.1: Type: text/plain, Size: 4226 bytes --]
Hello,
looks like sh is missing the some __user annotations so that sparse spwes these
warnings. Adding sh maintainers to Cc.
regards,
Marc
On 10/29/20 12:01 AM, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 23859ae44402f4d935b9ee548135dd1e65e2cbf4
> commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
> date: 3 weeks ago
> config: sh-randconfig-s031-20201028 (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-56-gc09e8239-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@intel.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
>
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2020-10-29 7:33 ` Marc Kleine-Budde
0 siblings, 0 replies; 16+ messages in thread
From: Marc Kleine-Budde @ 2020-10-29 7:33 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4228 bytes --]
Hello,
looks like sh is missing the some __user annotations so that sparse spwes these
warnings. Adding sh maintainers to Cc.
regards,
Marc
On 10/29/20 12:01 AM, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 23859ae44402f4d935b9ee548135dd1e65e2cbf4
> commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
> date: 3 weeks ago
> config: sh-randconfig-s031-20201028 (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-56-gc09e8239-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@intel.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(a)lists.01.org
>
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
2020-10-29 7:33 ` Marc Kleine-Budde
@ 2020-10-30 18:55 ` Oliver Hartkopp
-1 siblings, 0 replies; 16+ messages in thread
From: Oliver Hartkopp @ 2020-10-30 18:55 UTC (permalink / raw)
To: Marc Kleine-Budde, kernel test robot
Cc: kbuild-all, linux-kernel, Rich Felker, Yoshinori Sato
Hi all,
On 29.10.20 08:33, Marc Kleine-Budde wrote:
> Hello,
>
> looks like sh is missing the some __user annotations so that sparse spwes these
> warnings. Adding sh maintainers to Cc.
>
> regards,
> Marc
>
> On 10/29/20 12:01 AM, kernel test robot wrote:
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: 23859ae44402f4d935b9ee548135dd1e65e2cbf4
>> commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
>> date: 3 weeks ago
>> config: sh-randconfig-s031-20201028 (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-56-gc09e8239-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@intel.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
Sorry but there are tons of identical items in the networking subsystem
in getsockopt functions.
And I don't get the sparse warning with make C=1 for none of the
occurrences of
if (get_user(len, optlen))
return -EFAULT;
So why did this show up here?
Thanks for your work & best regards,
Oliver
ps. Using sparse 0.6.2 (Debian: 0.6.2-2) here.
>> 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
>>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2020-10-30 18:55 ` Oliver Hartkopp
0 siblings, 0 replies; 16+ messages in thread
From: Oliver Hartkopp @ 2020-10-30 18:55 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4551 bytes --]
Hi all,
On 29.10.20 08:33, Marc Kleine-Budde wrote:
> Hello,
>
> looks like sh is missing the some __user annotations so that sparse spwes these
> warnings. Adding sh maintainers to Cc.
>
> regards,
> Marc
>
> On 10/29/20 12:01 AM, kernel test robot wrote:
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: 23859ae44402f4d935b9ee548135dd1e65e2cbf4
>> commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
>> date: 3 weeks ago
>> config: sh-randconfig-s031-20201028 (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-56-gc09e8239-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@intel.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
Sorry but there are tons of identical items in the networking subsystem
in getsockopt functions.
And I don't get the sparse warning with make C=1 for none of the
occurrences of
if (get_user(len, optlen))
return -EFAULT;
So why did this show up here?
Thanks for your work & best regards,
Oliver
ps. Using sparse 0.6.2 (Debian: 0.6.2-2) here.
>> 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(a)lists.01.org
>>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
2020-10-30 18:55 ` Oliver Hartkopp
@ 2020-10-30 19:14 ` Marc Kleine-Budde
-1 siblings, 0 replies; 16+ messages in thread
From: Marc Kleine-Budde @ 2020-10-30 19:14 UTC (permalink / raw)
To: Oliver Hartkopp, kernel test robot
Cc: kbuild-all, linux-kernel, Rich Felker, Yoshinori Sato, linux-can
[-- Attachment #1.1: Type: text/plain, Size: 1184 bytes --]
On 10/30/20 7:55 PM, Oliver Hartkopp wrote:
>>> 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
>
> Sorry but there are tons of identical items in the networking subsystem
> in getsockopt functions.
>
> And I don't get the sparse warning with make C=1 for none of the
> occurrences of
Due to ARCH=sh
looks like sh is missing the some __user annotations so that sparse spwes these
warnings.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2020-10-30 19:14 ` Marc Kleine-Budde
0 siblings, 0 replies; 16+ messages in thread
From: Marc Kleine-Budde @ 2020-10-30 19:14 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]
On 10/30/20 7:55 PM, Oliver Hartkopp wrote:
>>> 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
>
> Sorry but there are tons of identical items in the networking subsystem
> in getsockopt functions.
>
> And I don't get the sparse warning with make C=1 for none of the
> occurrences of
Due to ARCH=sh
looks like sh is missing the some __user annotations so that sparse spwes these
warnings.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
2021-01-14 9:47 ` kernel test robot
@ 2021-01-14 18:22 ` Oliver Hartkopp
-1 siblings, 0 replies; 16+ messages in thread
From: Oliver Hartkopp @ 2021-01-14 18:22 UTC (permalink / raw)
To: kernel test robot; +Cc: kbuild-all, linux-kernel, Marc Kleine-Budde
On 14.01.21 10:47, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 65f0d2414b7079556fbbcc070b3d1c9f9587606d
> commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
> date: 3 months ago
> config: sh-randconfig-s032-20210114 (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-208-g46a52ca4-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@intel.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
>
This seems to be a problem with the sh4 arch and/or its cross
compilation tools.
There are tons of similar code snippets in the kernel, e.g. in
net/can/raw.c or net/bluetooth/hci_sock.c ...
And these code snippets do not trigger such sparse warnings?!?
Any idea?
Regards,
Oliver
> 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
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2021-01-14 18:22 ` Oliver Hartkopp
0 siblings, 0 replies; 16+ messages in thread
From: Oliver Hartkopp @ 2021-01-14 18:22 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4173 bytes --]
On 14.01.21 10:47, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 65f0d2414b7079556fbbcc070b3d1c9f9587606d
> commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
> date: 3 months ago
> config: sh-randconfig-s032-20210114 (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-208-g46a52ca4-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@intel.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
>
This seems to be a problem with the sh4 arch and/or its cross
compilation tools.
There are tons of similar code snippets in the kernel, e.g. in
net/can/raw.c or net/bluetooth/hci_sock.c ...
And these code snippets do not trigger such sparse warnings?!?
Any idea?
Regards,
Oliver
> 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(a)lists.01.org
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2021-01-14 9:47 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-01-14 9:47 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: kbuild-all, linux-kernel, Marc Kleine-Budde
[-- Attachment #1: Type: text/plain, Size: 3490 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 65f0d2414b7079556fbbcc070b3d1c9f9587606d
commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
date: 3 months ago
config: sh-randconfig-s032-20210114 (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-208-g46a52ca4-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@intel.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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 21039 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2021-01-14 9:47 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-01-14 9:47 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3581 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 65f0d2414b7079556fbbcc070b3d1c9f9587606d
commit: e057dd3fc20ffb3d7f150af46542a51b59b90127 can: add ISO 15765-2:2016 transport protocol
date: 3 months ago
config: sh-randconfig-s032-20210114 (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-208-g46a52ca4-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@intel.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(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 21039 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
2020-12-26 19:29 ` kernel test robot
@ 2021-01-04 9:11 ` Marc Kleine-Budde
-1 siblings, 0 replies; 16+ messages in thread
From: Marc Kleine-Budde @ 2021-01-04 9:11 UTC (permalink / raw)
To: kernel test robot, Oliver Hartkopp
Cc: kbuild-all, linux-kernel, Yoshinori Sato, Rich Felker, Linux-sh list
[-- Attachment #1.1: Type: text/plain, Size: 2974 bytes --]
On 12/26/20 8:29 PM, kernel test robot wrote:
> 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@intel.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
From my point of view, it looks like the get_user() on the sh platform is
somehow different to the other platform, which all accept a __user pointer. IMHO
this should be fixed in sh.
> 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))
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2021-01-04 9:11 ` Marc Kleine-Budde
0 siblings, 0 replies; 16+ messages in thread
From: Marc Kleine-Budde @ 2021-01-04 9:11 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2975 bytes --]
On 12/26/20 8:29 PM, kernel test robot wrote:
> 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@intel.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
>From my point of view, it looks like the get_user() on the sh platform is
somehow different to the other platform, which all accept a __user pointer. IMHO
this should be fixed in sh.
> 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))
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2020-12-26 19:29 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-12-26 19:29 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: kbuild-all, linux-kernel, Marc Kleine-Budde
[-- Attachment #1: Type: text/plain, Size: 3490 bytes --]
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@intel.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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 21119 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2020-12-26 19:29 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-12-26 19:29 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3581 bytes --]
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@intel.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(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 21119 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2021-01-14 18:25 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 23:01 net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces) kernel test robot
2020-10-28 23:01 ` kernel test robot
2020-10-29 7:33 ` Marc Kleine-Budde
2020-10-29 7:33 ` Marc Kleine-Budde
2020-10-30 18:55 ` Oliver Hartkopp
2020-10-30 18:55 ` Oliver Hartkopp
2020-10-30 19:14 ` Marc Kleine-Budde
2020-10-30 19:14 ` Marc Kleine-Budde
2020-12-26 19:29 kernel test robot
2020-12-26 19:29 ` kernel test robot
2021-01-04 9:11 ` Marc Kleine-Budde
2021-01-04 9:11 ` Marc Kleine-Budde
2021-01-14 9:47 kernel test robot
2021-01-14 9:47 ` kernel test robot
2021-01-14 18:22 ` Oliver Hartkopp
2021-01-14 18:22 ` Oliver Hartkopp
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.