From bd8ef6d35b87444c69277cc4647d24c9c614a089 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Thu, 3 Jun 2004 07:27:41 -0700 Subject: [PATCH] [PATCH] sparse: x25 annotation --- include/net/x25.h | 4 ++-- net/x25/af_x25.c | 25 +++++++++++++------------ net/x25/x25_link.c | 2 +- net/x25/x25_route.c | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/include/net/x25.h b/include/net/x25.h index c6153ea9eea0d..0db97e75853f0 100644 --- a/include/net/x25.h +++ b/include/net/x25.h @@ -196,7 +196,7 @@ extern void x25_transmit_restart_confirmation(struct x25_neigh *); extern void x25_transmit_diagnostic(struct x25_neigh *, unsigned char); extern void x25_transmit_clear_request(struct x25_neigh *, unsigned int, unsigned char); extern void x25_transmit_link(struct sk_buff *, struct x25_neigh *); -extern int x25_subscr_ioctl(unsigned int, void *); +extern int x25_subscr_ioctl(unsigned int, void __user *); extern struct x25_neigh *x25_get_neigh(struct net_device *); extern void x25_link_free(void); @@ -221,7 +221,7 @@ extern void x25_enquiry_response(struct sock *); extern struct x25_route *x25_get_route(struct x25_address *addr); extern struct net_device *x25_dev_get(char *); extern void x25_route_device_down(struct net_device *dev); -extern int x25_route_ioctl(unsigned int, void *); +extern int x25_route_ioctl(unsigned int, void __user *); extern void x25_route_free(void); static __inline__ void x25_route_hold(struct x25_route *rt) diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 9863ccd84de40..857dc981b9817 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -1180,6 +1180,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; struct x25_opt *x25 = x25_sk(sk); + void __user *argp = (void __user *)arg; int rc; switch (cmd) { @@ -1188,7 +1189,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) atomic_read(&sk->sk_wmem_alloc); if (amount < 0) amount = 0; - rc = put_user(amount, (unsigned int *)arg); + rc = put_user(amount, (unsigned int __user *)argp); break; } @@ -1201,7 +1202,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) */ if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; - rc = put_user(amount, (unsigned int *)arg); + rc = put_user(amount, (unsigned int __user *)argp); break; } @@ -1209,7 +1210,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) rc = -EINVAL; if (sk) rc = sock_get_timestamp(sk, - (struct timeval __user *)arg); + (struct timeval __user *)argp); break; case SIOCGIFADDR: case SIOCSIFADDR: @@ -1228,20 +1229,20 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) rc = -EPERM; if (!capable(CAP_NET_ADMIN)) break; - rc = x25_route_ioctl(cmd, (void *)arg); + rc = x25_route_ioctl(cmd, argp); break; case SIOCX25GSUBSCRIP: - rc = x25_subscr_ioctl(cmd, (void *)arg); + rc = x25_subscr_ioctl(cmd, argp); break; case SIOCX25SSUBSCRIP: rc = -EPERM; if (!capable(CAP_NET_ADMIN)) break; - rc = x25_subscr_ioctl(cmd, (void *)arg); + rc = x25_subscr_ioctl(cmd, argp); break; case SIOCX25GFACILITIES: { struct x25_facilities fac = x25->facilities; - rc = copy_to_user((void *)arg, &fac, + rc = copy_to_user(argp, &fac, sizeof(fac)) ? -EFAULT : 0; break; } @@ -1249,7 +1250,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case SIOCX25SFACILITIES: { struct x25_facilities facilities; rc = -EFAULT; - if (copy_from_user(&facilities, (void *)arg, + if (copy_from_user(&facilities, argp, sizeof(facilities))) break; rc = -EINVAL; @@ -1277,7 +1278,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case SIOCX25GCALLUSERDATA: { struct x25_calluserdata cud = x25->calluserdata; - rc = copy_to_user((void *)arg, &cud, + rc = copy_to_user(argp, &cud, sizeof(cud)) ? -EFAULT : 0; break; } @@ -1286,7 +1287,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) struct x25_calluserdata calluserdata; rc = -EFAULT; - if (copy_from_user(&calluserdata, (void *)arg, + if (copy_from_user(&calluserdata, argp, sizeof(calluserdata))) break; rc = -EINVAL; @@ -1300,13 +1301,13 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case SIOCX25GCAUSEDIAG: { struct x25_causediag causediag; causediag = x25->causediag; - rc = copy_to_user((void *)arg, &causediag, + rc = copy_to_user(argp, &causediag, sizeof(causediag)) ? -EFAULT : 0; break; } default: - rc = dev_ioctl(cmd, (void __user *)arg); + rc = dev_ioctl(cmd, argp); break; } diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index c5df945f3aad4..118146629c3a7 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c @@ -374,7 +374,7 @@ struct x25_neigh *x25_get_neigh(struct net_device *dev) /* * Handle the ioctls that control the subscription functions. */ -int x25_subscr_ioctl(unsigned int cmd, void *arg) +int x25_subscr_ioctl(unsigned int cmd, void __user *arg) { struct x25_subscrip_struct x25_subscr; struct x25_neigh *nb; diff --git a/net/x25/x25_route.c b/net/x25/x25_route.c index 07ae9d9e204ab..4697d55bb253a 100644 --- a/net/x25/x25_route.c +++ b/net/x25/x25_route.c @@ -174,7 +174,7 @@ struct x25_route *x25_get_route(struct x25_address *addr) /* * Handle the ioctls that control the routing functions. */ -int x25_route_ioctl(unsigned int cmd, void *arg) +int x25_route_ioctl(unsigned int cmd, void __user *arg) { struct x25_route_struct rt; struct net_device *dev; -- 2.53.0