Moin,

On 10/22/2010 10:11 AM, Kurt Van Dijck wrote:
>> This series of patches changes the can drivers RX path. If a RTR frame is
>> received no data is copied.
> 
> 1 remark to all patches:
> instead of copying 8 databytes, you now copy "can_dlc" bytes.
> 
> can_dlc is minimum 4bits, but the struct can_frame is only 8 bytes.
> Is this safe?
> Would memcpy(msg->data, REGS, MINIMUM(8, msg->can_dlc)) be better/safe?

You're absolutely right, but... :)
I checked that all drivers are now using get_can_dlc() [1], which
already does the limiting.

Let me just recheck Ira's patch for the TX path, ohh...
On the TX path we do the checking for invalid dlcs with
can_dropped_invalid_skb() [2], but the janz_ican3 driver doesn't have
this. I'm going to update the patch.

Thanks for checking the patches!

regards, Marc

[1] http://lxr.linux.no/linux+v2.6.36/include/linux/can/dev.h#L65
[2] http://lxr.linux.no/linux+v2.6.36/include/linux/can/dev.h#L68

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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core

Reply via email to