X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fhost%2Fuhci-debug.c;h=133e50c1b75aeef56f325655d0c6d6d9e67d28a7;hb=5d0dd51ddb446e7c058023420f5b7d4404501980;hp=a0721d06059eb48d6bc61cd006348f3190f0b076;hpb=a91482bdcc2e0f6035702e46f1b99043a0893346;p=linux-2.6.git diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index a0721d060..133e50c1b 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c @@ -571,7 +571,22 @@ 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; - return simple_read_from_buffer(buf, nbytes, ppos, up->data, up->size); + unsigned int pos; + unsigned int size; + + pos = *ppos; + size = up->size; + if (pos >= size) + return 0; + if (nbytes > size - pos) + nbytes = size - pos; + + if (copy_to_user(buf, up->data + pos, nbytes)) + return -EFAULT; + + *ppos += nbytes; + + return nbytes; } static int uhci_proc_release(struct inode *inode, struct file *file)