Re: [net-rfc 04/16] can: dev: can_get_len(): add a helper function to get the correct length of Classical frames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/21/20 9:11 AM, Joakim Zhang wrote:
> I wonder if it's appropriate to ask this question here, why this RAW_DLC
> issue might run into some buffer overflow issue? Will it cause frames dropped
> finally?

On the wire the dlc for CAN-2.0 frames ca go from 0...15. In the RX-path the DLC
for CAN-2.0 frames is capped to 8.

So userspace only ever sees a max dlc of 8. This way you can loop over the
struct can_frame::data. If we pass the dlc of the wire uncapped, you may loop
until 15 :)

In the TX-path we currently drop CAN-2.0 frames with dlc >8.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux