This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / char / sx.c
index 1ca3d25..643163b 100644 (file)
 #define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000
 #endif
 
-#ifdef CONFIG_PCI
 static struct pci_device_id sx_pci_tbl[] = {
        { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, PCI_ANY_ID, PCI_ANY_ID },
        { 0 }
 };
 MODULE_DEVICE_TABLE(pci, sx_pci_tbl);
-#endif /* CONFIG_PCI */
 
 /* Configurable options: 
    (Don't be too sure that it'll work if you toggle them) */
@@ -1594,8 +1592,7 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp,
                         unsigned int cmd, unsigned long arg)
 {
        int rc = 0;
-       int __user *descr = (int __user *)arg;
-       int i;
+       int *descr = (int *)arg, i;
        static struct sx_board *board = NULL;
        int nbytes, offset;
        unsigned long data;
@@ -1671,7 +1668,7 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp,
                get_user (data,  descr++);
                while (nbytes && data) {
                        for (i=0;i<nbytes;i += SX_CHUNK_SIZE) {
-                               if (copy_from_user(tmp, (char __user *)data+i, 
+                               if (copy_from_user(tmp, (char *)data + i, 
                                                   (i + SX_CHUNK_SIZE >
                                                    nbytes) ? nbytes - i :
                                                              SX_CHUNK_SIZE)) {
@@ -1777,7 +1774,6 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp,
 {
        int rc;
        struct sx_port *port = tty->driver_data;
-       void __user *argp = (void __user *)arg;
        int ival;
 
        /* func_enter2(); */
@@ -1786,20 +1782,24 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp,
        switch (cmd) {
        case TIOCGSOFTCAR:
                rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0),
-                             (unsigned __user *) argp);
+                             (unsigned int *) arg);
                break;
        case TIOCSSOFTCAR:
-               if ((rc = get_user(ival, (unsigned __user *) argp)) == 0) {
+               if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
                        tty->termios->c_cflag =
                                (tty->termios->c_cflag & ~CLOCAL) |
                                (ival ? CLOCAL : 0);
                }
                break;
        case TIOCGSERIAL:
-               rc = gs_getserial(&port->gs, argp);
+               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
+                                     sizeof(struct serial_struct))) == 0)
+                       rc = gs_getserial(&port->gs, (struct serial_struct *) arg);
                break;
        case TIOCSSERIAL:
-               rc = gs_setserial(&port->gs, argp);
+               if ((rc = verify_area(VERIFY_READ, (void *) arg,
+                                     sizeof(struct serial_struct))) == 0)
+                       rc = gs_setserial(&port->gs, (struct serial_struct *) arg);
                break;
        default:
                rc = -ENOIOCTLCMD;