In looking through drivers/char/pty.c, I saw a couple of places where
the MIN() macro is used and one of its arguments is a function call
which could potentially return a different number each time it is
called, particularly on SMP systems. Here is a patch to fix that.
Paul.
diff -urN official/drivers/char/pty.c linux/drivers/char/pty.c
--- official/drivers/char/pty.c Thu Apr 13 10:25:09 2000
+++ linux/drivers/char/pty.c Thu Apr 13 21:37:13 2000
@@ -149,7 +149,9 @@
temp_buffer = &tty->flip.char_buf[0];
while (count > 0) {
/* check space so we don't copy needlessly */
- n = MIN(count, to->ldisc.receive_room(to));
+ n = to->ldisc.receive_room(to);
+ if (n > count)
+ n = count;
if (!n) break;
n = MIN(n, PTY_BUF_SIZE);
@@ -161,7 +163,9 @@
}
/* check again in case the buffer filled up */
- n = MIN(n, to->ldisc.receive_room(to));
+ n = to->ldisc.receive_room(to);
+ if (n > count)
+ n = count;
if (!n) break;
buf += n;
c += n;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:10 EST