patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / net / bluetooth / bnep / sock.c
index 0978a58..990e503 100644 (file)
@@ -77,6 +77,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
        struct bnep_conndel_req  cd;
        struct bnep_conninfo ci;
        struct socket *nsock;
+       void __user *argp = (void __user *)arg;
        int err;
 
        BT_DBG("cmd %x arg %lx", cmd, arg);
@@ -86,7 +87,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
                if (!capable(CAP_NET_ADMIN))
                        return -EACCES;
 
-               if (copy_from_user(&ca, (void *) arg, sizeof(ca)))
+               if (copy_from_user(&ca, argp, sizeof(ca)))
                        return -EFAULT;
        
                nsock = sockfd_lookup(ca.sock, &err);
@@ -100,7 +101,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
 
                err = bnep_add_connection(&ca, nsock);
                if (!err) {
-                       if (copy_to_user((void *) arg, &ca, sizeof(ca)))
+                       if (copy_to_user(argp, &ca, sizeof(ca)))
                                err = -EFAULT;
                } else
                        fput(nsock->file);
@@ -111,30 +112,30 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
                if (!capable(CAP_NET_ADMIN))
                        return -EACCES;
 
-               if (copy_from_user(&cd, (void *) arg, sizeof(cd)))
+               if (copy_from_user(&cd, argp, sizeof(cd)))
                        return -EFAULT;
        
                return bnep_del_connection(&cd);
 
        case BNEPGETCONNLIST:
-               if (copy_from_user(&cl, (void *) arg, sizeof(cl)))
+               if (copy_from_user(&cl, argp, sizeof(cl)))
                        return -EFAULT;
 
                if (cl.cnum <= 0)
                        return -EINVAL;
        
                err = bnep_get_connlist(&cl);
-               if (!err && copy_to_user((void *) arg, &cl, sizeof(cl)))
+               if (!err && copy_to_user(argp, &cl, sizeof(cl)))
                        return -EFAULT;
 
                return err;
 
        case BNEPGETCONNINFO:
-               if (copy_from_user(&ci, (void *) arg, sizeof(ci)))
+               if (copy_from_user(&ci, argp, sizeof(ci)))
                        return -EFAULT;
 
                err = bnep_get_conninfo(&ci);
-               if (!err && copy_to_user((void *) arg, &ci, sizeof(ci)))
+               if (!err && copy_to_user(argp, &ci, sizeof(ci)))
                        return -EFAULT;
 
                return err;