Re: net/can/isotp.c:1240:13: sparse: sparse: incorrect type in initializer (different address spaces)

From: Marc Kleine-Budde
Date: Fri Oct 30 2020 - 15:15:06 EST


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: signature.asc
Description: OpenPGP digital signature