[2.6.7-rc1-mm1] lp int copy_to_user replaced

From: FabF
Date: Thu May 27 2004 - 12:34:32 EST


Andrew,

Here's a patch to have standard __put_user for integer transfers in lp
driver.Is it correct ?

Regards,
FabF
diff -Naur orig/drivers/char/lp.c edited/drivers/char/lp.c
--- orig/drivers/char/lp.c 2004-05-10 04:31:58.000000000 +0200
+++ edited/drivers/char/lp.c 2004-05-27 19:28:12.581860488 +0200
@@ -31,6 +31,8 @@
* Obsoleted and removed all the lowlevel stuff implemented in the last
* month to use the IEEE1284 functions (that handle the _new_ compatibilty
* mode fine).
+ *
+ * 27-MAY-2004 Replace int copy_to_user with put_user (Fabian Frederick)
*/

/* This driver should, in theory, work with any parallel port that has an
@@ -603,16 +605,14 @@
return -EINVAL;
break;
case LPGETIRQ:
- if (copy_to_user((int *) arg, &LP_IRQ(minor),
- sizeof(int)))
+ if (__put_user(LP_IRQ(minor), (int *) arg))
return -EFAULT;
break;
case LPGETSTATUS:
lp_claim_parport_or_block (&lp_table[minor]);
status = r_str(minor);
lp_release_parport (&lp_table[minor]);
-
- if (copy_to_user((int *) arg, &status, sizeof(int)))
+ if (__put_user(status, (int *) arg))
return -EFAULT;
break;
case LPRESET:
@@ -630,7 +630,7 @@
#endif
case LPGETFLAGS:
status = LP_F(minor);
- if (copy_to_user((int *) arg, &status, sizeof(int)))
+ if (__put_user(status, (int *) arg))
return -EFAULT;
break;