diff options
author | Alex Shi <alex.shi@linaro.org> | 2016-01-14 22:26:03 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2016-01-14 22:26:03 +0800 |
commit | 8fa6d2e1fe937af9dbacb5aad8c43dbb67466fa0 (patch) | |
tree | 53b1cbcaec14e50f491e1cb1f20106c7a15c70e8 /drivers/usb/serial/symbolserial.c | |
parent | 74bc3fe5f5fbb50d63fd002ce240cc7bca236db1 (diff) | |
parent | f90ae1b62bedd8b57966a7be68855f2d43170db6 (diff) |
Merge branch 'linux-linaro-lsk-v3.18' into linux-linaro-lsk-v3.18-androidlsk-v3.18-16.01-android
Diffstat (limited to 'drivers/usb/serial/symbolserial.c')
-rw-r--r-- | drivers/usb/serial/symbolserial.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c index 6ed804450a5a..37f3ad15ed06 100644 --- a/drivers/usb/serial/symbolserial.c +++ b/drivers/usb/serial/symbolserial.c @@ -60,17 +60,15 @@ static void symbol_int_callback(struct urb *urb) usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data); + /* + * Data from the device comes with a 1 byte header: + * + * <size of data> <data>... + */ if (urb->actual_length > 1) { - data_length = urb->actual_length - 1; - - /* - * Data from the device comes with a 1 byte header: - * - * <size of data>data... - * This is real data to be sent to the tty layer - * we pretty much just ignore the size and send everything - * else to the tty layer. - */ + data_length = data[0]; + if (data_length > (urb->actual_length - 1)) + data_length = urb->actual_length - 1; tty_insert_flip_string(&port->port, &data[1], data_length); tty_flip_buffer_push(&port->port); } else { |