X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fhost%2Fuhci-debug.c;h=86e4c3a11e06527155f608ce10650441094d1944;hb=4e4f43fe003969bdaa246374b90e16708a22ef79;hp=c2e63e29b75a43c36933a1040d4f24d69c057671;hpb=86090fcac5e27b630656fe3d963a6b80e26dac44;p=linux-2.6.git diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index c2e63e29b..86e4c3a11 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c @@ -567,8 +567,8 @@ static loff_t uhci_proc_lseek(struct file *file, loff_t off, int whence) return (file->f_pos = new); } -static ssize_t uhci_proc_read(struct file *file, char *buf, size_t nbytes, - loff_t *ppos) +static ssize_t uhci_proc_read(struct file *file, char __user *buf, + size_t nbytes, loff_t *ppos) { struct uhci_proc *up = file->private_data; unsigned int pos; @@ -578,14 +578,9 @@ static ssize_t uhci_proc_read(struct file *file, char *buf, size_t nbytes, size = up->size; if (pos >= size) return 0; - if (nbytes >= size) - nbytes = size; - if (pos + nbytes > size) + if (nbytes > size - pos) nbytes = size - pos; - if (!access_ok(VERIFY_WRITE, buf, nbytes)) - return -EINVAL; - if (copy_to_user(buf, up->data + pos, nbytes)) return -EFAULT;