* [PATCH] UML - Don't trash return value
@ 2004-09-23 2:26 Jeff Dike
0 siblings, 0 replies; only message in thread
From: Jeff Dike @ 2004-09-23 2:26 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, blaisorblade_spam
From: Doug Dumitru <doug@easyco.com>
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 <blaisorblade_spam@yahoo.it>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: linux-2.6.9-rc2-mm1-orig/arch/um/drivers/line.c
===================================================================
--- linux-2.6.9-rc2-mm1-orig.orig/arch/um/drivers/line.c 2004-09-22 20:39:58.000000000 -0400
+++ linux-2.6.9-rc2-mm1-orig/arch/um/drivers/line.c 2004-09-22 20:55:34.000000000 -0400
@@ -73,9 +73,8 @@
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-09-23 1:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-23 2:26 [PATCH] UML - Don't trash return value Jeff Dike
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®