can: kvaser_usb: Fix comparison bug in kvaser_usb_read_bulk_callback()
authorJimmy Assarsson <jimmyassarsson@gmail.com>
Tue, 21 Nov 2017 07:22:27 +0000 (08:22 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 1 Dec 2017 10:20:52 +0000 (11:20 +0100)
commite84f44eb5523401faeb9cc1c97895b68e3cfb78d
tree4e7e4280fe5743d7997fa22fb168dc7ca46a2251
parent435019b48033138581a6171093b181fc6b4d3d30
can: kvaser_usb: Fix comparison bug in kvaser_usb_read_bulk_callback()

The conditon in the while-loop becomes true when actual_length is less than
2 (MSG_HEADER_LEN). In best case we end up with a former, already
dispatched msg, that got msg->len greater than actual_length. This will
result in a "Format error" error printout.

Problem seen when unplugging a Kvaser USB device connected to a vbox guest.

warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]

Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/kvaser_usb.c