Commit e661cf70 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

n_tty: Clarify copy_from_read_buf()

Add a temporary for the computed source address and substitute
where appropriate. No functional change.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 679e7c29
...@@ -2014,11 +2014,11 @@ static int copy_from_read_buf(struct tty_struct *tty, ...@@ -2014,11 +2014,11 @@ static int copy_from_read_buf(struct tty_struct *tty,
n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail); n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail);
n = min(*nr, n); n = min(*nr, n);
if (n) { if (n) {
retval = copy_to_user(*b, read_buf_addr(ldata, tail), n); const unsigned char *from = read_buf_addr(ldata, tail);
retval = copy_to_user(*b, from, n);
n -= retval; n -= retval;
is_eof = n == 1 && read_buf(ldata, tail) == EOF_CHAR(tty); is_eof = n == 1 && *from == EOF_CHAR(tty);
tty_audit_add_data(tty, read_buf_addr(ldata, tail), n, tty_audit_add_data(tty, from, n, ldata->icanon);
ldata->icanon);
smp_store_release(&ldata->read_tail, ldata->read_tail + n); smp_store_release(&ldata->read_tail, ldata->read_tail + n);
/* Turn single EOF into zero-length read */ /* Turn single EOF into zero-length read */
if (L_EXTPROC(tty) && ldata->icanon && is_eof && if (L_EXTPROC(tty) && ldata->icanon && is_eof &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment