* includes a KILL command to abort any connection.
* VERY useful for debugging ;-)
*/
-static int ax25_ctl_ioctl(const unsigned int cmd, void *arg)
+static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
{
struct ax25_ctl_struct ax25_ctl;
ax25_digi digi;
*/
static int ax25_setsockopt(struct socket *sock, int level, int optname,
- char *optval, int optlen)
+ char __user *optval, int optlen)
{
struct sock *sk = sock->sk;
ax25_cb *ax25;
if (optlen < sizeof(int))
return -EINVAL;
- if (get_user(opt, (int *)optval))
+ if (get_user(opt, (int __user *)optval))
return -EFAULT;
lock_sock(sk);
}
static int ax25_getsockopt(struct socket *sock, int level, int optname,
- char *optval, int *optlen)
+ char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
ax25_cb *ax25;
size_t size;
int lv, err, addr_len = msg->msg_namelen;
- if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) {
+ if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
return -EINVAL;
- }
lock_sock(sk);
ax25 = ax25_sk(sk);
static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
struct sock *sk = sock->sk;
+ void __user *argp = (void __user *)arg;
int res = 0;
lock_sock(sk);
amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
if (amount < 0)
amount = 0;
- res = put_user(amount, (int *)arg);
+ res = put_user(amount, (int __user *)argp);
break;
}
/* These two are safe on a single CPU system as only user tasks fiddle here */
if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
amount = skb->len;
- res = put_user(amount, (int *)arg);
+ res = put_user(amount, (int __user *)argp);
break;
}
case SIOCGSTAMP:
if (sk != NULL) {
- res = sock_get_timestamp(sk, (struct timeval *)arg);
+ res = sock_get_timestamp(sk, argp);
break;
}
res = -EINVAL;
case SIOCAX25DELUID: /* Delete a uid from the uid/call map table */
case SIOCAX25GETUID: {
struct sockaddr_ax25 sax25;
- if (copy_from_user(&sax25, (void *)arg, sizeof(sax25))) {
+ if (copy_from_user(&sax25, argp, sizeof(sax25))) {
res = -EFAULT;
break;
}
res = -EPERM;
break;
}
- if (get_user(amount, (long *)arg)) {
+ if (get_user(amount, (long __user *)argp)) {
res = -EFAULT;
break;
}
res = -EPERM;
break;
}
- res = ax25_rt_ioctl(cmd, (void *)arg);
+ res = ax25_rt_ioctl(cmd, argp);
break;
case SIOCAX25CTLCON:
res = -EPERM;
break;
}
- res = ax25_ctl_ioctl(cmd, (void *)arg);
+ res = ax25_ctl_ioctl(cmd, argp);
break;
case SIOCAX25GETINFO:
warned=1;
}
- if (copy_to_user((void *)arg, &ax25_info, sizeof(struct ax25_info_struct_deprecated))) {
+ if (copy_to_user(argp, &ax25_info, sizeof(struct ax25_info_struct_deprecated))) {
res = -EFAULT;
break;
}
} else {
- if (copy_to_user((void *)arg, &ax25_info, sizeof(struct ax25_info_struct))) {
+ if (copy_to_user(argp, &ax25_info, sizeof(struct ax25_info_struct))) {
res = -EINVAL;
break;
}
res = -EPERM;
break;
}
- if (copy_from_user(&ax25_fwd, (void *)arg, sizeof(ax25_fwd))) {
+ if (copy_from_user(&ax25_fwd, argp, sizeof(ax25_fwd))) {
res = -EFAULT;
break;
}
break;
default:
- res = dev_ioctl(cmd, (void *)arg);
+ res = dev_ioctl(cmd, argp);
break;
}
release_sock(sk);