ChangeSet 1.1401, 2003/06/10 16:37:47-07:00, greg@kroah.com [PATCH] USB: lots of sparse fixups for usbfs drivers/usb/core/devio.c | 102 +++++++++++++++++++++---------------------- include/linux/usbdevice_fs.h | 8 +-- 2 files changed, 55 insertions(+), 55 deletions(-) diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c --- a/drivers/usb/core/devio.c Tue Jun 10 17:10:47 2003 +++ b/drivers/usb/core/devio.c Tue Jun 10 17:10:47 2003 @@ -49,14 +49,14 @@ #include "hcd.h" /* for usbcore internals */ struct async { - struct list_head asynclist; - struct dev_state *ps; + struct list_head asynclist; + struct dev_state *ps; struct task_struct *task; unsigned int signr; unsigned int intf; - void *userbuffer; - void *userurb; - struct urb *urb; + void __user *userbuffer; + void __user *userurb; + struct urb *urb; }; static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig) @@ -83,7 +83,7 @@ return ret; } -static ssize_t usbdev_read(struct file *file, char * buf, size_t nbytes, loff_t *ppos) +static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { struct dev_state *ps = (struct dev_state *)file->private_data; ssize_t ret = 0; @@ -235,7 +235,7 @@ return as; } -extern __inline__ struct async *async_getpending(struct dev_state *ps, void *userurb) +extern __inline__ struct async *async_getpending(struct dev_state *ps, void __user *userurb) { unsigned long flags; struct async *as; @@ -265,7 +265,7 @@ sinfo.si_signo = as->signr; sinfo.si_errno = as->urb->status; sinfo.si_code = SI_ASYNCIO; - sinfo.si_addr = as->userurb; + sinfo.si_addr = (void *)as->userurb; send_sig_info(as->signr, &sinfo, as->task); } } @@ -536,7 +536,7 @@ return 0; } -static int proc_control(struct dev_state *ps, void *arg) +static int proc_control(struct dev_state *ps, void __user *arg) { struct usb_device *dev = ps->dev; struct usbdevfs_ctrltransfer ctrl; @@ -544,7 +544,7 @@ unsigned char *tbuf; int i, ret; - if (copy_from_user(&ctrl, (void *)arg, sizeof(ctrl))) + if (copy_from_user(&ctrl, arg, sizeof(ctrl))) return -EFAULT; if ((ret = check_ctrlrecip(ps, ctrl.bRequestType, ctrl.wIndex))) return ret; @@ -586,7 +586,7 @@ return i; } -static int proc_bulk(struct dev_state *ps, void *arg) +static int proc_bulk(struct dev_state *ps, void __user *arg) { struct usb_device *dev = ps->dev; struct usbdevfs_bulktransfer bulk; @@ -595,7 +595,7 @@ unsigned char *tbuf; int i, ret; - if (copy_from_user(&bulk, (void *)arg, sizeof(bulk))) + if (copy_from_user(&bulk, arg, sizeof(bulk))) return -EFAULT; if ((ret = findintfep(ps->dev, bulk.ep)) < 0) return ret; @@ -641,12 +641,12 @@ return len2; } -static int proc_resetep(struct dev_state *ps, void *arg) +static int proc_resetep(struct dev_state *ps, void __user *arg) { unsigned int ep; int ret; - if (get_user(ep, (unsigned int *)arg)) + if (get_user(ep, (unsigned int __user *)arg)) return -EFAULT; if ((ret = findintfep(ps->dev, ep)) < 0) return ret; @@ -656,13 +656,13 @@ return 0; } -static int proc_clearhalt(struct dev_state *ps, void *arg) +static int proc_clearhalt(struct dev_state *ps, void __user *arg) { unsigned int ep; int pipe; int ret; - if (get_user(ep, (unsigned int *)arg)) + if (get_user(ep, (unsigned int __user *)arg)) return -EFAULT; if ((ret = findintfep(ps->dev, ep)) < 0) return ret; @@ -677,7 +677,7 @@ } -static int proc_getdriver(struct dev_state *ps, void *arg) +static int proc_getdriver(struct dev_state *ps, void __user *arg) { struct usbdevfs_getdriver gd; struct usb_interface *interface; @@ -698,7 +698,7 @@ return 0; } -static int proc_connectinfo(struct dev_state *ps, void *arg) +static int proc_connectinfo(struct dev_state *ps, void __user *arg) { struct usbdevfs_connectinfo ci; @@ -733,7 +733,7 @@ return 0; } -static int proc_setintf(struct dev_state *ps, void *arg) +static int proc_setintf(struct dev_state *ps, void __user *arg) { struct usbdevfs_setinterface setintf; struct usb_interface *interface; @@ -755,18 +755,18 @@ return 0; } -static int proc_setconfig(struct dev_state *ps, void *arg) +static int proc_setconfig(struct dev_state *ps, void __user *arg) { unsigned int u; - if (get_user(u, (unsigned int *)arg)) + if (get_user(u, (unsigned int __user *)arg)) return -EFAULT; if (usb_set_configuration(ps->dev, u) < 0) return -EINVAL; return 0; } -static int proc_submiturb(struct dev_state *ps, void *arg) +static int proc_submiturb(struct dev_state *ps, void __user *arg) { struct usbdevfs_urb uurb; struct usbdevfs_iso_packet_desc *isopkt = NULL; @@ -804,7 +804,7 @@ return -EINVAL; if (!(dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL))) return -ENOMEM; - if (copy_from_user(dr, (unsigned char*)uurb.buffer, 8)) { + if (copy_from_user(dr, uurb.buffer, 8)) { kfree(dr); return -EFAULT; } @@ -930,7 +930,7 @@ return 0; } -static int proc_unlinkurb(struct dev_state *ps, void *arg) +static int proc_unlinkurb(struct dev_state *ps, void __user *arg) { struct async *as; @@ -972,11 +972,11 @@ return 0; } -static int proc_reapurb(struct dev_state *ps, void *arg) +static int proc_reapurb(struct dev_state *ps, void __user *arg) { DECLARE_WAITQUEUE(wait, current); struct async *as = NULL; - void *addr; + void __user *addr; int ret; add_wait_queue(&ps->wait, &wait); @@ -1007,10 +1007,10 @@ return -EIO; } -static int proc_reapurbnonblock(struct dev_state *ps, void *arg) +static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg) { struct async *as; - void *addr; + void __user *addr; int ret; if (!(as = async_getcompleted(ps))) @@ -1025,7 +1025,7 @@ return 0; } -static int proc_disconnectsignal(struct dev_state *ps, void *arg) +static int proc_disconnectsignal(struct dev_state *ps, void __user *arg) { struct usbdevfs_disconnectsignal ds; @@ -1038,24 +1038,24 @@ return 0; } -static int proc_claiminterface(struct dev_state *ps, void *arg) +static int proc_claiminterface(struct dev_state *ps, void __user *arg) { unsigned int intf; int ret; - if (get_user(intf, (unsigned int *)arg)) + if (get_user(intf, (unsigned int __user *)arg)) return -EFAULT; if ((ret = findintfif(ps->dev, intf)) < 0) return ret; return claimintf(ps, ret); } -static int proc_releaseinterface(struct dev_state *ps, void *arg) +static int proc_releaseinterface(struct dev_state *ps, void __user *arg) { unsigned int intf; int ret; - if (get_user(intf, (unsigned int *)arg)) + if (get_user(intf, (unsigned int __user *)arg)) return -EFAULT; if ((ret = findintfif(ps->dev, intf)) < 0) return ret; @@ -1065,7 +1065,7 @@ return 0; } -static int proc_ioctl (struct dev_state *ps, void *arg) +static int proc_ioctl (struct dev_state *ps, void __user *arg) { struct usbdevfs_ioctl ctrl; int size; @@ -1075,7 +1075,7 @@ struct usb_driver *driver = 0; /* get input parameters and alloc buffer */ - if (copy_from_user(&ctrl, (void *) arg, sizeof (ctrl))) + if (copy_from_user(&ctrl, arg, sizeof (ctrl))) return -EFAULT; if ((size = _IOC_SIZE (ctrl.ioctl_code)) > 0) { if ((buf = kmalloc (size, GFP_KERNEL)) == 0) @@ -1173,19 +1173,19 @@ } switch (cmd) { case USBDEVFS_CONTROL: - ret = proc_control(ps, (void *)arg); + ret = proc_control(ps, (void __user *)arg); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_BULK: - ret = proc_bulk(ps, (void *)arg); + ret = proc_bulk(ps, (void __user *)arg); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_RESETEP: - ret = proc_resetep(ps, (void *)arg); + ret = proc_resetep(ps, (void __user *)arg); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; @@ -1195,59 +1195,59 @@ break; case USBDEVFS_CLEAR_HALT: - ret = proc_clearhalt(ps, (void *)arg); + ret = proc_clearhalt(ps, (void __user *)arg); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_GETDRIVER: - ret = proc_getdriver(ps, (void *)arg); + ret = proc_getdriver(ps, (void __user *)arg); break; case USBDEVFS_CONNECTINFO: - ret = proc_connectinfo(ps, (void *)arg); + ret = proc_connectinfo(ps, (void __user *)arg); break; case USBDEVFS_SETINTERFACE: - ret = proc_setintf(ps, (void *)arg); + ret = proc_setintf(ps, (void __user *)arg); break; case USBDEVFS_SETCONFIGURATION: - ret = proc_setconfig(ps, (void *)arg); + ret = proc_setconfig(ps, (void __user *)arg); break; case USBDEVFS_SUBMITURB: - ret = proc_submiturb(ps, (void *)arg); + ret = proc_submiturb(ps, (void __user *)arg); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_DISCARDURB: - ret = proc_unlinkurb(ps, (void *)arg); + ret = proc_unlinkurb(ps, (void __user *)arg); break; case USBDEVFS_REAPURB: - ret = proc_reapurb(ps, (void *)arg); + ret = proc_reapurb(ps, (void __user *)arg); break; case USBDEVFS_REAPURBNDELAY: - ret = proc_reapurbnonblock(ps, (void *)arg); + ret = proc_reapurbnonblock(ps, (void __user *)arg); break; case USBDEVFS_DISCSIGNAL: - ret = proc_disconnectsignal(ps, (void *)arg); + ret = proc_disconnectsignal(ps, (void __user *)arg); break; case USBDEVFS_CLAIMINTERFACE: - ret = proc_claiminterface(ps, (void *)arg); + ret = proc_claiminterface(ps, (void __user *)arg); break; case USBDEVFS_RELEASEINTERFACE: - ret = proc_releaseinterface(ps, (void *)arg); + ret = proc_releaseinterface(ps, (void __user *)arg); break; case USBDEVFS_IOCTL: - ret = proc_ioctl(ps, (void *) arg); + ret = proc_ioctl(ps, (void __user *) arg); break; } up_read(&ps->devsem); diff -Nru a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h --- a/include/linux/usbdevice_fs.h Tue Jun 10 17:10:47 2003 +++ b/include/linux/usbdevice_fs.h Tue Jun 10 17:10:47 2003 @@ -46,14 +46,14 @@ __u16 wIndex; __u16 wLength; __u32 timeout; /* in milliseconds */ - void *data; + void __user *data; }; struct usbdevfs_bulktransfer { unsigned int ep; unsigned int len; unsigned int timeout; /* in milliseconds */ - void *data; + void __user *data; }; struct usbdevfs_setinterface { @@ -97,7 +97,7 @@ unsigned char endpoint; int status; unsigned int flags; - void *buffer; + void __user *buffer; int buffer_length; int actual_length; int start_frame; @@ -113,7 +113,7 @@ int ifno; /* interface 0..N ; negative numbers reserved */ int ioctl_code; /* MUST encode size + direction of data so the * macros in give correct values */ - void *data; /* param buffer (in, or out) */ + void __user *data; /* param buffer (in, or out) */ }; /* You can do most things with hubs just through control messages,