diff options
author | Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> | 2015-05-17 20:01:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-24 15:43:50 -0400 |
commit | da555db6b06340e3f6b4b0a0448c30bebfe23b0a (patch) | |
tree | 872aae27524cdd0ff3c9da0bd0efa679ad6bf66c | |
parent | 392bceedb107a3dc1d4287e63d7670d08f702feb (diff) |
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>
-rw-r--r-- | drivers/tty/n_tty.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index cc57a3a6b02b..759604e57b24 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -2070,8 +2070,8 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, | |||
2070 | 2070 | ||
2071 | size = N_TTY_BUF_SIZE - tail; | 2071 | size = N_TTY_BUF_SIZE - tail; |
2072 | n = eol - tail; | 2072 | n = eol - tail; |
2073 | if (n > 4096) | 2073 | if (n > N_TTY_BUF_SIZE) |
2074 | n += 4096; | 2074 | n += N_TTY_BUF_SIZE; |
2075 | n += found; | 2075 | n += found; |
2076 | c = n; | 2076 | c = n; |
2077 | 2077 | ||