From: Alan Cox This sorts out the termios/termios2 handling as before but also merges a tiny fix from Andrew that broke compiles and also a further readjustment of the memcpy handling which cleans up slightly and also fixed a test suite failure. Signed-off-by: Alan Cox Signed-off-by: Andrew Morton --- drivers/char/tty_ioctl.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -puN drivers/char/tty_ioctl.c~tty_ioctl-use-termios-for-the-old-structure-and-termios2-update drivers/char/tty_ioctl.c --- a/drivers/char/tty_ioctl.c~tty_ioctl-use-termios-for-the-old-structure-and-termios2-update +++ a/drivers/char/tty_ioctl.c @@ -399,14 +399,14 @@ static int set_termios(struct tty_struct if (retval) return retval; + memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios)); + if (opt & TERMIOS_TERMIO) { - memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios)); if (user_termio_to_kernel_termios(&tmp_termios, (struct termio __user *)arg)) return -EFAULT; #ifdef TCGETS2 } else if (opt & TERMIOS_OLD) { - memcpy(&tmp_termios, tty->termios, sizeof(struct termios)); if (user_termios_to_kernel_termios_1(&tmp_termios, (struct termios __user *)arg)) return -EFAULT; _