Commit 6e3a9a7f authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: rose annotation

parent e48caf2c
...@@ -207,7 +207,7 @@ extern struct net_device *rose_dev_get(rose_address *); ...@@ -207,7 +207,7 @@ extern struct net_device *rose_dev_get(rose_address *);
extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *); extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *);
extern struct net_device *rose_ax25_dev_get(char *); extern struct net_device *rose_ax25_dev_get(char *);
extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsigned char *); extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsigned char *);
extern int rose_rt_ioctl(unsigned int, void *); extern int rose_rt_ioctl(unsigned int, void __user *);
extern void rose_link_failed(ax25_cb *, int); extern void rose_link_failed(ax25_cb *, int);
extern int rose_route_frame(struct sk_buff *, ax25_cb *); extern int rose_route_frame(struct sk_buff *, ax25_cb *);
extern void rose_rt_free(void); extern void rose_rt_free(void);
......
...@@ -1249,6 +1249,7 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1249,6 +1249,7 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
rose_cb *rose = rose_sk(sk); rose_cb *rose = rose_sk(sk);
void __user *argp = (void __user *)arg;
switch (cmd) { switch (cmd) {
case TIOCOUTQ: { case TIOCOUTQ: {
...@@ -1256,7 +1257,7 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1256,7 +1257,7 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
if (amount < 0) if (amount < 0)
amount = 0; amount = 0;
return put_user(amount, (unsigned int *)arg); return put_user(amount, (unsigned int __user *)argp);
} }
case TIOCINQ: { case TIOCINQ: {
...@@ -1265,12 +1266,12 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1265,12 +1266,12 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
/* These two are safe on a single CPU system as only user tasks fiddle here */ /* These two are safe on a single CPU system as only user tasks fiddle here */
if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
amount = skb->len; amount = skb->len;
return put_user(amount, (unsigned int *)arg); return put_user(amount, (unsigned int __user *)argp);
} }
case SIOCGSTAMP: case SIOCGSTAMP:
if (sk != NULL) if (sk != NULL)
return sock_get_timestamp(sk, (struct timeval __user *)arg); return sock_get_timestamp(sk, (struct timeval __user *)argp);
return -EINVAL; return -EINVAL;
case SIOCGIFADDR: case SIOCGIFADDR:
...@@ -1290,18 +1291,18 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1290,18 +1291,18 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCRSCLRRT: case SIOCRSCLRRT:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
return rose_rt_ioctl(cmd, (void *)arg); return rose_rt_ioctl(cmd, argp);
case SIOCRSGCAUSE: { case SIOCRSGCAUSE: {
struct rose_cause_struct rose_cause; struct rose_cause_struct rose_cause;
rose_cause.cause = rose->cause; rose_cause.cause = rose->cause;
rose_cause.diagnostic = rose->diagnostic; rose_cause.diagnostic = rose->diagnostic;
return copy_to_user((void *)arg, &rose_cause, sizeof(struct rose_cause_struct)) ? -EFAULT : 0; return copy_to_user(argp, &rose_cause, sizeof(struct rose_cause_struct)) ? -EFAULT : 0;
} }
case SIOCRSSCAUSE: { case SIOCRSSCAUSE: {
struct rose_cause_struct rose_cause; struct rose_cause_struct rose_cause;
if (copy_from_user(&rose_cause, (void *)arg, sizeof(struct rose_cause_struct))) if (copy_from_user(&rose_cause, argp, sizeof(struct rose_cause_struct)))
return -EFAULT; return -EFAULT;
rose->cause = rose_cause.cause; rose->cause = rose_cause.cause;
rose->diagnostic = rose_cause.diagnostic; rose->diagnostic = rose_cause.diagnostic;
...@@ -1312,14 +1313,14 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1312,14 +1313,14 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
if (!capable(CAP_NET_ADMIN)) return -EPERM; if (!capable(CAP_NET_ADMIN)) return -EPERM;
if (ax25cmp(&rose_callsign, &null_ax25_address) != 0) if (ax25cmp(&rose_callsign, &null_ax25_address) != 0)
ax25_listen_release(&rose_callsign, NULL); ax25_listen_release(&rose_callsign, NULL);
if (copy_from_user(&rose_callsign, (void *)arg, sizeof(ax25_address))) if (copy_from_user(&rose_callsign, argp, sizeof(ax25_address)))
return -EFAULT; return -EFAULT;
if (ax25cmp(&rose_callsign, &null_ax25_address) != 0) if (ax25cmp(&rose_callsign, &null_ax25_address) != 0)
ax25_listen_register(&rose_callsign, NULL); ax25_listen_register(&rose_callsign, NULL);
return 0; return 0;
case SIOCRSGL2CALL: case SIOCRSGL2CALL:
return copy_to_user((void *)arg, &rose_callsign, sizeof(ax25_address)) ? -EFAULT : 0; return copy_to_user(argp, &rose_callsign, sizeof(ax25_address)) ? -EFAULT : 0;
case SIOCRSACCEPT: case SIOCRSACCEPT:
if (rose->state == ROSE_STATE_5) { if (rose->state == ROSE_STATE_5) {
...@@ -1335,7 +1336,7 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1335,7 +1336,7 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
return 0; return 0;
default: default:
return dev_ioctl(cmd, (void __user *)arg); return dev_ioctl(cmd, argp);
} }
return 0; return 0;
......
...@@ -710,7 +710,7 @@ struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause, ...@@ -710,7 +710,7 @@ struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause,
/* /*
* Handle the ioctls that control the routing functions. * Handle the ioctls that control the routing functions.
*/ */
int rose_rt_ioctl(unsigned int cmd, void *arg) int rose_rt_ioctl(unsigned int cmd, void __user *arg)
{ {
struct rose_route_struct rose_route; struct rose_route_struct rose_route;
struct net_device *dev; struct net_device *dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment