patch-2.1.4 linux/drivers/char/tty_ioctl.c

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

diff -u --recursive --new-file v2.1.3/linux/drivers/char/tty_ioctl.c linux/drivers/char/tty_ioctl.c
@@ -155,14 +155,14 @@
 		if (retval)
 			return retval;
 		tmp_termios = *tty->termios;
-		memcpy_fromfs(&tmp_termio, (struct termio *) arg,
+		copy_from_user(&tmp_termio, (struct termio *) arg,
 			      sizeof (struct termio));
 		trans_from_termio(&tmp_termio, &tmp_termios);
 	} else {
 		retval = verify_area(VERIFY_READ, (void *) arg, sizeof(struct termios));
 		if (retval)
 			return retval;
-		memcpy_fromfs(&tmp_termios, (struct termios *) arg,
+		copy_from_user(&tmp_termios, (struct termios *) arg,
 			      sizeof (struct termios));
 	}
 
@@ -185,7 +185,7 @@
 	if (i)
 		return i;
 	trans_to_termio(tty->termios, &tmp_termio);
-	memcpy_tofs(termio, &tmp_termio, sizeof (struct termio));
+	copy_to_user(termio, &tmp_termio, sizeof (struct termio));
 	return 0;
 }
 
@@ -244,7 +244,7 @@
 	tmp.sg_erase = tty->termios->c_cc[VERASE];
 	tmp.sg_kill = tty->termios->c_cc[VKILL];
 	tmp.sg_flags = get_sgflags(tty);
-	memcpy_tofs(sgttyb, &tmp, sizeof(tmp));
+	copy_to_user(sgttyb, &tmp, sizeof(tmp));
 	return 0;
 }
 
@@ -286,7 +286,7 @@
 	if (retval)
 		return retval;
 	termios =  *tty->termios;
-	memcpy_fromfs(&tmp, sgttyb, sizeof(tmp));
+	copy_from_user(&tmp, sgttyb, sizeof(tmp));
 	termios.c_cc[VERASE] = tmp.sg_erase;
 	termios.c_cc[VKILL] = tmp.sg_kill;
 	set_sgflags(&termios, tmp.sg_flags);
@@ -310,7 +310,7 @@
 	tmp.t_stopc = tty->termios->c_cc[VSTOP];
 	tmp.t_eofc = tty->termios->c_cc[VEOF];
 	tmp.t_brkc = tty->termios->c_cc[VEOL2];	/* what is brkc anyway? */
-	memcpy_tofs(tchars, &tmp, sizeof(tmp));
+	copy_to_user(tchars, &tmp, sizeof(tmp));
 	return 0;
 }
 
@@ -322,7 +322,7 @@
 	retval = verify_area(VERIFY_READ, tchars, sizeof(struct tchars));
 	if (retval)
 		return retval;
-	memcpy_fromfs(&tmp, tchars, sizeof(tmp));
+	copy_from_user(&tmp, tchars, sizeof(tmp));
 	tty->termios->c_cc[VINTR] = tmp.t_intrc;
 	tty->termios->c_cc[VQUIT] = tmp.t_quitc;
 	tty->termios->c_cc[VSTART] = tmp.t_startc;
@@ -348,7 +348,7 @@
 	tmp.t_flushc = tty->termios->c_cc[VEOL2];	/* what is flushc anyway? */
 	tmp.t_werasc = tty->termios->c_cc[VWERASE];
 	tmp.t_lnextc = tty->termios->c_cc[VLNEXT];
-	memcpy_tofs(ltchars, &tmp, sizeof(tmp));
+	copy_to_user(ltchars, &tmp, sizeof(tmp));
 	return 0;
 }
 
@@ -360,7 +360,7 @@
 	retval = verify_area(VERIFY_READ, ltchars, sizeof(struct ltchars));
 	if (retval)
 		return retval;
-	memcpy_fromfs(&tmp, ltchars, sizeof(tmp));
+	copy_from_user(&tmp, ltchars, sizeof(tmp));
 	tty->termios->c_cc[VSUSP] = tmp.t_suspc;
 	tty->termios->c_cc[VEOL2] = tmp.t_dsuspc;	/* what is dsuspc anyway? */
 	tty->termios->c_cc[VREPRINT] = tmp.t_rprntc;
@@ -409,7 +409,7 @@
 					     sizeof (struct termios));
 			if (retval)
 				return retval;
-			memcpy_tofs((struct termios *) arg,
+			copy_to_user((struct termios *) arg,
 				    real_tty->termios,
 				    sizeof (struct termios));
 			return 0;
@@ -489,19 +489,17 @@
 					     sizeof (unsigned long));
 			if (retval)
 				return retval;
+			retval = tty->read_cnt;
 			if (L_ICANON(tty))
-				put_fs_long(inq_canon(tty),
-					(unsigned long *) arg);
-			else
-				put_fs_long(tty->read_cnt,
-					    (unsigned long *) arg);
+				retval = inq_canon(tty);
+			put_user(retval, (unsigned int *) arg);
 			return 0;
 		case TIOCGLCKTRMIOS:
 			retval = verify_area(VERIFY_WRITE, (void *) arg,
 					     sizeof (struct termios));
 			if (retval)
 				return retval;
-			memcpy_tofs((struct termios *) arg,
+			copy_to_user((struct termios *) arg,
 				    real_tty->termios_locked,
 				    sizeof (struct termios));
 			return 0;
@@ -512,7 +510,7 @@
 					     sizeof (struct termios));
 			if (retval)
 				return retval;
-			memcpy_fromfs(real_tty->termios_locked,
+			copy_from_user(real_tty->termios_locked,
 				      (struct termios *) arg,
 				      sizeof (struct termios));
 			return 0;
@@ -524,7 +522,8 @@
 					     sizeof (int));
 			if (retval)
 				return retval;
-			if (get_user((int*)arg)) {
+			get_user(retval, (int *) arg);
+			if (retval) {
 				if (!tty->packet) {
 					tty->packet = 1;
 					tty->link->ctrl_status = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov