public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] n_tty: Clarify copy_from_read_buf()
@ 2015-11-08 14:35 Peter Hurley
  2015-11-08 14:35 ` [PATCH] n_tty: Uninline tty_copy_to_user() Peter Hurley
  2015-11-27 19:11 ` [PATCH v2 0/3] n_tty_read() helper cleanups Peter Hurley
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Hurley @ 2015-11-08 14:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-kernel, Peter Hurley

Add a temporary for the computed source address and substitute
where appropriate. No functional change.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/n_tty.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index b2b01d5..bc613b8 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -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(*nr, 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;
-		is_eof = n == 1 && read_buf(ldata, tail) == EOF_CHAR(tty);
-		tty_audit_add_data(tty, read_buf_addr(ldata, tail), n,
-				ldata->icanon);
+		is_eof = n == 1 && *from == EOF_CHAR(tty);
+		tty_audit_add_data(tty, from, n, ldata->icanon);
 		smp_store_release(&ldata->read_tail, ldata->read_tail + n);
 		/* Turn single EOF into zero-length read */
 		if (L_EXTPROC(tty) && ldata->icanon && is_eof &&
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-27 19:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-08 14:35 [PATCH] n_tty: Clarify copy_from_read_buf() Peter Hurley
2015-11-08 14:35 ` [PATCH] n_tty: Uninline tty_copy_to_user() Peter Hurley
2015-11-27 19:11 ` [PATCH v2 0/3] n_tty_read() helper cleanups Peter Hurley
2015-11-27 19:11   ` [PATCH v2 1/3] n_tty: Uninline tty_copy_to_user() Peter Hurley
2015-11-27 19:11   ` [PATCH v2 2/3] n_tty: Clarify copy_from_read_buf() Peter Hurley
2015-11-27 19:11   ` [PATCH v2 3/3] n_tty: Reduce branching in canon_copy_from_read_buf() Peter Hurley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox