summaryrefslogtreecommitdiffstats
path: root/drivers/char/ppdev.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-10-05 01:18:40 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-10-05 01:18:40 +0000
commit012bb3e61e5eced6c610f9e036372bf0c8def2d1 (patch)
tree87efc733f9b164e8c85c0336f92c8fb7eff6d183 /drivers/char/ppdev.c
parent625a1589d3d6464b5d90b8a0918789e3afffd220 (diff)
Merge with Linux 2.4.0-test9. Please check DECstation, I had a number
of rejects to fixup while integrating Linus patches. I also found that this kernel will only boot SMP on Origin; the UP kernel freeze soon after bootup with SCSI timeout messages. I commit this anyway since I found that the last CVS versions had the same problem.
Diffstat (limited to 'drivers/char/ppdev.c')
-rw-r--r--drivers/char/ppdev.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index 07877c1a7..9b85db1d6 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -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>
@@ -179,7 +185,7 @@ static ssize_t pp_write (struct file * file, const char * buf, size_t count,
wrote = parport_write (pp->pdev->port, kbuffer, n);
- if (wrote < 0) {
+ if (wrote <= 0) {
if (!bytes_written)
bytes_written = wrote;
break;
@@ -369,19 +375,19 @@ static int pp_ioctl(struct inode *inode, struct file *file,
case PPRSTATUS:
reg = parport_read_status (port);
- return copy_to_user ((unsigned char *) arg, &reg,
- sizeof (reg));
-
+ if (copy_to_user ((unsigned char *) arg, &reg, sizeof (reg)))
+ return -EFAULT;
+ return 0;
case PPRDATA:
reg = parport_read_data (port);
- return copy_to_user ((unsigned char *) arg, &reg,
- sizeof (reg));
-
+ if (copy_to_user ((unsigned char *) arg, &reg, sizeof (reg)))
+ return -EFAULT;
+ return 0;
case PPRCONTROL:
reg = parport_read_control (port);
- return copy_to_user ((unsigned char *) arg, &reg,
- sizeof (reg));
-
+ if (copy_to_user ((unsigned char *) arg, &reg, sizeof (reg)))
+ return -EFAULT;
+ return 0;
case PPYIELD:
parport_yield_blocking (pp->pdev);
return 0;