aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Viro <viro@www.linux.org.uk>2005-04-03 18:06:39 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-03 18:06:39 -0700
commitb32adaf212f545a028c39a464fe0e3377a2f9b7c (patch)
treec8cca25be4d9b26dd010f62aaee03791a13431ee
parent63c706b924ed0422b6816a72b8704bc3ed872792 (diff)
[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>
-rw-r--r--drivers/usb/misc/usblcd.c7
-rw-r--r--drivers/usb/usb-skeleton.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index dcdf9b4abb7cc..096ab30296763 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -109,6 +109,7 @@ static ssize_t lcd_read(struct file *file, char __user * buffer, size_t count, l
{
struct usb_lcd *dev;
int retval = 0;
+ int bytes_read;
dev = (struct usb_lcd *)file->private_data;
@@ -117,14 +118,14 @@ static ssize_t lcd_read(struct file *file, char __user * buffer, size_t count, l
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 1bb67337fe6f8..6051a646fe69d 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -112,6 +112,7 @@ static ssize_t skel_read(struct file *file, char *buffer, size_t count, loff_t *
{
struct usb_skel *dev;
int retval = 0;
+ int bytes_read;
dev = (struct usb_skel *)file->private_data;
@@ -120,14 +121,14 @@ static ssize_t skel_read(struct file *file, char *buffer, size_t count, loff_t *
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;