patch-2.2.16 linux/drivers/char/n_tty.c

Next file: linux/drivers/char/nvram.c
Previous file: linux/drivers/char/n_hdlc.c
Back to the patch index
Back to the overall index

diff -urN v2.2.15/linux/drivers/char/n_tty.c linux/drivers/char/n_tty.c
@@ -228,9 +228,9 @@
 		nr = space;
 	if (nr > sizeof(buf))
 	    nr = sizeof(buf);
-	nr -= copy_from_user(buf, inbuf, nr);
-	if (!nr)
-		return 0;
+
+	if (copy_from_user(buf, inbuf, nr))
+		return -EFAULT;
 	
 	for (i = 0, cp = buf; i < nr; i++, cp++) {
 		switch (*cp) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)