mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-24 19:45:06 +08:00
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>
This commit is contained in:
parent
e3afc5b0d7
commit
48a6ab8867
@ -853,9 +853,8 @@ static ssize_t iterate_tty_read(struct tty_ldisc *ld, struct tty_struct *tty,
|
||||
size_t copied, count = iov_iter_count(to);
|
||||
|
||||
do {
|
||||
ssize_t size;
|
||||
ssize_t size = min(count, sizeof(kernel_buf));
|
||||
|
||||
size = count > sizeof(kernel_buf) ? sizeof(kernel_buf) : count;
|
||||
size = ld->ops->read(tty, file, kernel_buf, size, &cookie, offset);
|
||||
if (!size)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user