diff options
| author | Flavien Lebarbé <flavien@lebarbe.net> | 2002-06-13 02:45:54 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2002-06-13 02:45:54 -0700 |
| commit | 4e56217101ba9a63768833b94eb63bbbb8561945 (patch) | |
| tree | f2ec4596bce7fd75943cf8338d549a615e1929e3 /drivers | |
| parent | d94f43cdfa6d95c85d7d55cbc430105dd5f0ca79 (diff) | |
[PATCH] usblp_ioctl for non-little-endian machines
ioctl(LPGETSTATUS) is known to put the status into an int. The usblp
driver has a problem in this area as it does not put it into an int but
into a char. Let's see :
from drivers/char/lp.c : lp_ioctl :
int status
copy_to_user((int *) arg, &status, sizeof(int))
from drivers/usb/printer.c : usblp_ioctl :
unsigned char status;
copy_to_user ((unsigned char *)arg, &status, 1)
Even though in most cases it can work unnoticed on little-endian
machines ;o), it's broken on non-little-endian machines (I got bitten on
PPC).
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/usb/class/printer.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/class/printer.c b/drivers/usb/class/printer.c index 06f256f0c2db..7689c3e9caed 100644 --- a/drivers/usb/class/printer.c +++ b/drivers/usb/class/printer.c @@ -418,7 +418,8 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, { struct usblp *usblp = file->private_data; int length, err, i; - unsigned char status, newChannel; + unsigned char lpstatus, newChannel; + int status; int twoints[2]; int retval = 0; @@ -569,12 +570,13 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, switch (cmd) { case LPGETSTATUS: - if (usblp_read_status(usblp, &status)) { + if (usblp_read_status(usblp, &lpstatus)) { err("usblp%d: failed reading printer status", usblp->minor); retval = -EIO; goto done; } - if (copy_to_user ((unsigned char *)arg, &status, 1)) + status = lpstatus; + if (copy_to_user ((int *)arg, &status, sizeof(int))) retval = -EFAULT; break; |
