net: ioctl: Use kernel memory on protocol ioctl callbacks
[linux-2.6-block.git] / net / dccp / proto.c
index b0ebf853cb07bf4fa04cbdb9713ce070e7297101..f331e5977a8447d9884fe1ddbcac72ed32f5dece 100644 (file)
@@ -362,7 +362,7 @@ __poll_t dccp_poll(struct file *file, struct socket *sock,
 
 EXPORT_SYMBOL_GPL(dccp_poll);
 
-int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg)
+int dccp_ioctl(struct sock *sk, int cmd, int *karg)
 {
        int rc = -ENOTCONN;
 
@@ -373,17 +373,17 @@ int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg)
 
        switch (cmd) {
        case SIOCOUTQ: {
-               int amount = sk_wmem_alloc_get(sk);
+               *karg = sk_wmem_alloc_get(sk);
                /* Using sk_wmem_alloc here because sk_wmem_queued is not used by DCCP and
                 * always 0, comparably to UDP.
                 */
 
-               rc = put_user(amount, (int __user *)arg);
+               rc = 0;
        }
                break;
        case SIOCINQ: {
                struct sk_buff *skb;
-               unsigned long amount = 0;
+               *karg = 0;
 
                skb = skb_peek(&sk->sk_receive_queue);
                if (skb != NULL) {
@@ -391,9 +391,9 @@ int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg)
                         * We will only return the amount of this packet since
                         * that is all that will be read.
                         */
-                       amount = skb->len;
+                       *karg = skb->len;
                }
-               rc = put_user(amount, (int __user *)arg);
+               rc = 0;
        }
                break;
        default: