mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
n_tty: Fix calculation of size in canon_copy_from_read_buf
There was a hardcoded value of 4096 which should have been N_TTY_BUF_SIZE. This caused reads from tty to fail with EFAULT when they shouldn't have done if N_TTY_BUF_SIZE was declared to be something other than 4096. Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
392bceedb1
commit
da555db6b0
1 changed files with 2 additions and 2 deletions
|
@ -2070,8 +2070,8 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
|
||||||
|
|
||||||
size = N_TTY_BUF_SIZE - tail;
|
size = N_TTY_BUF_SIZE - tail;
|
||||||
n = eol - tail;
|
n = eol - tail;
|
||||||
if (n > 4096)
|
if (n > N_TTY_BUF_SIZE)
|
||||||
n += 4096;
|
n += N_TTY_BUF_SIZE;
|
||||||
n += found;
|
n += found;
|
||||||
c = n;
|
c = n;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue