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: use min() for size computation in iterate_tty_read()

The computation is more obvious with min().

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

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
48a6ab88 e3afc5b0

+1 -2
+1 -2
drivers/tty/tty_io.c
··· 853 853 size_t copied, count = iov_iter_count(to); 854 854 855 855 do { 856 - ssize_t size; 856 + ssize_t size = min(count, sizeof(kernel_buf)); 857 857 858 - size = count > sizeof(kernel_buf) ? sizeof(kernel_buf) : count; 859 858 size = ld->ops->read(tty, file, kernel_buf, size, &cookie, offset); 860 859 if (!size) 861 860 break;