Commit 48a6ab88 authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman
Browse files

tty: use min() for size computation in iterate_tty_read()

parent e3afc5b0
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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;