[PATCH] usblcd portability fix usblcd.c passes address of size_t variable to function that expects int *. That breaks on 64bit big-endian, obviously. Fixed, along with the usb-skeleton.c - that's where the bug had been copied from. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index dcdf9b4..096ab30 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c
@@ -109,6 +109,7 @@ { struct usb_lcd *dev; int retval = 0; + int bytes_read; dev = (struct usb_lcd *)file->private_data; @@ -117,14 +118,14 @@ usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr), dev->bulk_in_buffer, min(dev->bulk_in_size, count), - &count, 10000); + &bytes_read, 10000); /* if the read was successful, copy the data to userspace */ if (!retval) { - if (copy_to_user(buffer, dev->bulk_in_buffer, count)) + if (copy_to_user(buffer, dev->bulk_in_buffer, bytes_read)) retval = -EFAULT; else - retval = count; + retval = bytes_read; } return retval;
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index 1bb6733..6051a64 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c
@@ -112,6 +112,7 @@ { struct usb_skel *dev; int retval = 0; + int bytes_read; dev = (struct usb_skel *)file->private_data; @@ -120,14 +121,14 @@ usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr), dev->bulk_in_buffer, min(dev->bulk_in_size, count), - &count, 10000); + &bytes_read, 10000); /* if the read was successful, copy the data to userspace */ if (!retval) { - if (copy_to_user(buffer, dev->bulk_in_buffer, count)) + if (copy_to_user(buffer, dev->bulk_in_buffer, bytes_read)) retval = -EFAULT; else - retval = count; + retval = bytes_read; } return retval;