can: slcan: allow reception of short error messages
authorCarlos Sanchez <carlossanchez@geotab.com>
Tue, 20 May 2025 10:23:05 +0000 (12:23 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 21 May 2025 08:12:05 +0000 (10:12 +0200)
commitef0841e4cb08754be6cb42bf97739fce5d086e5f
tree4217f4861b72b9cf053fa0bb07f14153d83de3aa
parentbe19a9228d08de2e7f20602b1fd68bac241330e4
can: slcan: allow reception of short error messages

Allows slcan to receive short messages (typically errors) from the serial
interface.

When error support was added to slcan protocol in
b32ff4668544e1333b694fcc7812b2d7397b4d6a ("can: slcan: extend the protocol
with error info") the minimum valid message size changed from 5 (minimum
standard can frame tIII0) to 3 ("e1a" is a valid protocol message, it is
one of the examples given in the comments for slcan_bump_err() ), but the
check for minimum message length prodicating all decoding was not adjusted.
This makes short error messages discarded and error frames not being
generated.

This patch changes the minimum length to the new minimum (3 characters,
excluding terminator, is now a valid message).

Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
Fixes: b32ff4668544 ("can: slcan: extend the protocol with error info")
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://patch.msgid.link/20250520102305.1097494-1-carlossanchez@geotab.com
Cc: stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/slcan/slcan-core.c