Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tty: don't pass write() to do_tty_write()

write() passed to do_tty_write() is always ld->ops->write(). Instead,
align with iterate_tty_read() and pass the whole ld instead. This makes
the code easier to follow as it is clear what the write is. And also the
function signature is more readable.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20230810091510.13006-22-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
f47a4fd6 b97552eb

+4 -7
+4 -7
drivers/tty/tty_io.c
··· 961 961 * Split writes up in sane blocksizes to avoid 962 962 * denial-of-service type attacks 963 963 */ 964 - static inline ssize_t do_tty_write( 965 - ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char *, size_t), 966 - struct tty_struct *tty, 967 - struct file *file, 968 - struct iov_iter *from) 964 + static inline ssize_t do_tty_write(struct tty_ldisc *ld, struct tty_struct *tty, 965 + struct file *file, struct iov_iter *from) 969 966 { 970 967 size_t count = iov_iter_count(from); 971 968 ssize_t ret, written = 0; ··· 1019 1022 if (copy_from_iter(tty->write_buf, size, from) != size) 1020 1023 break; 1021 1024 1022 - ret = write(tty, file, tty->write_buf, size); 1025 + ret = ld->ops->write(tty, file, tty->write_buf, size); 1023 1026 if (ret <= 0) 1024 1027 break; 1025 1028 ··· 1090 1093 if (!ld->ops->write) 1091 1094 ret = -EIO; 1092 1095 else 1093 - ret = do_tty_write(ld->ops->write, tty, file, from); 1096 + ret = do_tty_write(ld, tty, file, from); 1094 1097 tty_ldisc_deref(ld); 1095 1098 return ret; 1096 1099 }