I wrote :
> 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.
>
> [ attached, patches to linux-2.4.18 and 2.5.21]
Greg KH requested :
> The patch against 2.4.18 will not apply to the latest 2.4.19-pre10
> kernel. Could you rediff it please?
Here it is (patch is the same as the one against 2.5.21/printer.c).
Even though the patch is pretty obvious, and is functionnaly the same as
the one I tested, I must warn : I didn't test this particular kernel
version myself.
Flavien.
--- linux-2.4.19pre10/drivers/usb/printer.c Thu Jun 13 22:18:01 2002
+++ linux.fl/drivers/usb/printer.c Thu Jun 13 22:39:21 2002
@@ -388,7 +388,8 @@
{
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;
@@ -539,12 +540,13 @@
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;