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]

 



> -----Original Message-----
> From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> Sent: 2020年10月21日 15:21
> To: Joakim Zhang <qiangqing.zhang@xxxxxxx>; Vincent MAILHOL
> <mailhol.vincent@xxxxxxxxxx>; Oliver Hartkopp <socketcan@xxxxxxxxxxxx>;
> linux-can@xxxxxxxxxxxxxxx
> Cc: kernel@xxxxxxxxxxxxxx; Stéphane Grosjean
> <s.grosjean@xxxxxxxxxxxxxxx>
> Subject: Re: [net-rfc 04/16] can: dev: can_get_len(): add a helper function to
> get the correct length of Classical frames
> 
> 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.

Thanks Marc, now I understand the meaning of "run into some buffer overflow". 😊

Best Regards,
Joakim Zhang
> 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 |





[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