mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Fix Specialix SX corruption
@ 2006-02-27 11:08 Marc Zyngier
  2006-02-27 12:08 ` Rogier Wolff
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Zyngier @ 2006-02-27 11:08 UTC (permalink / raw)
  To: R.E.Wolff; +Cc: linux-kernel, akpm, torvalds, alan

Roger,

With the latest kernels, I experienced some strange corruption, some
'*****' being randomly inserted in the character flow, like this:

ashes:~#
ashes:~#
a*******shes:~#
ashes:~#
ashes:~#

Further investigation shows that the problem was introduced during
Alan's "TTY layer buffering revamp" patch, the amount of data to be
copied being reduced after buffer allocation. Moving the count fixup
around solves the problem.

Patch against v2.6.16-rc5.

Signed-off-by: Marc Zyngier <maz@misterjones.org>

diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index 588e75e..a6b4f02 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -1095,17 +1095,17 @@ static inline void sx_receive_chars (str
 
 		sx_dprintk (SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); 
 
+		/* Don't copy past the end of the hardware receive buffer */
+		if (rx_op + c > 0x100) c = 0x100 - rx_op;
+
+		sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c);
+
 		/* Don't copy more bytes than there is room for in the buffer */
 
 		c = tty_prepare_flip_string(tty, &rp, c);
 
 		sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); 
 
-		/* Don't copy past the end of the hardware receive buffer */
-		if (rx_op + c > 0x100) c = 0x100 - rx_op;
-
-		sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c);
-
 		/* If for one reason or another, we can't copy more data, we're done! */
 		if (c == 0) break;
 

-- 
And if you don't know where you're going, any road will take you there...

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

end of thread, other threads:[~2006-02-27 12:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-27 11:08 [PATCH] Fix Specialix SX corruption Marc Zyngier
2006-02-27 12:08 ` Rogier Wolff

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

Powered by JetHome