Em Fri, Aug 25, 2000 at 09:41:37AM -0500, Michael Elizabeth Chastain escreveu:
> > Please take a look and consider applying. Feedback about why it would
> > be wrong would be greatly appreciated.
>
> I eyeballed this and it looks correct to me, except that the comment
> at the top is slightly wrong.
>
> On error, copy_from_user and copy_to_user do not return -EFAULT,
> They return the positive number of bytes *not* copied due to address
> space errors.
Ok, fixed. 8)
- Arnaldo
--- linux-2.4.0-test7/drivers/char/ppdev.c Thu Jul 13 01:58:42 2000
+++ linux-2.4.0-test7.acme/drivers/char/ppdev.c Fri Aug 25 09:00:36 2000
@@ -39,7 +39,13 @@
* read/write read or write in current IEEE 1284 protocol
* select wait for interrupt (in readfds)
*
+ * Changes:
* Added SETTIME/GETTIME ioctl, Fred Barnes 1999.
+ *
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 2000/08/25
+ * - On error, copy_from_user and copy_to_user do not return -EFAULT,
+ * They return the positive number of bytes *not* copied due to address
+ * space errors.
*/
#include <linux/module.h>
@@ -369,19 +375,19 @@
case PPRSTATUS:
reg = parport_read_status (port);
- return copy_to_user ((unsigned char *) arg, ®,
- sizeof (reg));
-
+ if (copy_to_user ((unsigned char *) arg, ®, sizeof (reg)))
+ return -EFAULT;
+ return 0;
case PPRDATA:
reg = parport_read_data (port);
- return copy_to_user ((unsigned char *) arg, ®,
- sizeof (reg));
-
+ if (copy_to_user ((unsigned char *) arg, ®, sizeof (reg)))
+ return -EFAULT;
+ return 0;
case PPRCONTROL:
reg = parport_read_control (port);
- return copy_to_user ((unsigned char *) arg, ®,
- sizeof (reg));
-
+ if (copy_to_user ((unsigned char *) arg, ®, sizeof (reg)))
+ return -EFAULT;
+ return 0;
case PPYIELD:
parport_yield_blocking (pp->pdev);
return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:16 EST