Re: buffer overflows in the tty flip buffer in 2.6.17

From: Jiri Slaby
Date: Sat Feb 17 2007 - 08:15:03 EST

Mockern napsal(a):
When data is received from the hardware, it needs to be placed into the tty device's flip buffer. This can be done with the following bit of code:

for (i = 0; i < data_size; ++i) {
if (tty->flip.count >= TTY_FLIPBUF_SIZE)
tty_insert_flip_char(tty, data[i], 0);

size = tty_buffer_request_room(tty, data_size);
tty_insert_flip_string(tty, data, min(data_size, size));
+ cope with size < data_size (some data_size -= size with 3 lines above in do {} while (data_size))

-- Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E

Hnus <hnus@xxxxxxxxxx> is an alias for /dev/null
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at