Commit d1913e39 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

n_tty: Fix type mismatches in receive_buf raw copy

Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6f9b028a
...@@ -1444,24 +1444,27 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -1444,24 +1444,27 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
struct n_tty_data *ldata = tty->disc_data; struct n_tty_data *ldata = tty->disc_data;
const unsigned char *p; const unsigned char *p;
char *f, flags = TTY_NORMAL; char *f, flags = TTY_NORMAL;
int i;
char buf[64]; char buf[64];
if (ldata->real_raw) { if (ldata->real_raw) {
i = min(N_TTY_BUF_SIZE - read_cnt(ldata), size_t n, head;
N_TTY_BUF_SIZE - (ldata->read_head & (N_TTY_BUF_SIZE - 1)));
i = min(count, i); head = ldata->read_head & (N_TTY_BUF_SIZE - 1);
memcpy(read_buf_addr(ldata, ldata->read_head), cp, i); n = N_TTY_BUF_SIZE - max(read_cnt(ldata), head);
ldata->read_head += i; n = min_t(size_t, count, n);
cp += i; memcpy(read_buf_addr(ldata, head), cp, n);
count -= i; ldata->read_head += n;
cp += n;
i = min(N_TTY_BUF_SIZE - read_cnt(ldata), count -= n;
N_TTY_BUF_SIZE - (ldata->read_head & (N_TTY_BUF_SIZE - 1)));
i = min(count, i); head = ldata->read_head & (N_TTY_BUF_SIZE - 1);
memcpy(read_buf_addr(ldata, ldata->read_head), cp, i); n = N_TTY_BUF_SIZE - max(read_cnt(ldata), head);
ldata->read_head += i; n = min_t(size_t, count, n);
memcpy(read_buf_addr(ldata, head), cp, n);
ldata->read_head += n;
} else { } else {
int i;
for (i = count, p = cp, f = fp; i; i--, p++) { for (i = count, p = cp, f = fp; i; i--, p++) {
if (f) if (f)
flags = *f++; flags = *f++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment