From: Jeff Dike From: Doug Dumitru I have been fighting a buffering error when sending large amounts of data out pty devices from UML. I have tried a couple of patches that did not really fix the problem (and were rightly rejected by the group), but have finally found the real bug. In /arch/um/drivers/line.c there is a function "buffer_data" that is responsible for storing data into the lines ring buffer. The function is "supposed" to return the number of characters actually buffered. Unfortunately, in the case where the buffer wraps, the "len" variable is decremented by "end" before it is used as the return parameter. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton --- 25-akpm/arch/um/drivers/line.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff -puN arch/um/drivers/line.c~uml-dont-trash-return-value arch/um/drivers/line.c --- 25/arch/um/drivers/line.c~uml-dont-trash-return-value 2004-09-23 00:08:21.100868144 -0700 +++ 25-akpm/arch/um/drivers/line.c 2004-09-23 00:08:21.104867536 -0700 @@ -73,9 +73,8 @@ static int buffer_data(struct line *line else { memcpy(line->tail, buf, end); buf += end; - len -= end; - memcpy(line->buffer, buf, len); - line->tail = line->buffer + len; + memcpy(line->buffer, buf, len - end); + line->tail = line->buffer + len - end; } return(len); _