-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Matthias Fuchs wrote: > On Monday 11 January 2010 20:39, Marc Kleine-Budde wrote: >>> + >>> + if (!netif_device_present(netdev)) >>> + return; >>> + >>> + done_index = msg->msg.txdone.hnd & ~0x80000000; >>> + context = &priv->tx_contexts[done_index]; >> How far do you trust your hardware? I mean what about doing some out of >> bounds checking for the tx_contexts array? If MAX_TX_URBS is a power of >> two you can adjust the mask here.... > Hmm, of course the hardware and firmware are absolutely free of errors:-) > My firmware colleague confirmed this ;-) > > Nevertheless bounds checking is not a bad idea and increasing MAX_TX_URBS > from 10 to 2^4 does not cost much, so using a mask here is the best way.
> But what about a device that returns a done_index that's incorrect but > smaller than MAX_TX_URBS. At least you won't read or write someone else's memory or unmapped pages. Marc - -- 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 | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAktMeagACgkQjTAFq1RaXHPqbQCfVuXdOpEy0egRhDnZtLQFMlIN sDEAoIKseLFohgSg7OgAd53fvJTSB+2P =9DrA -----END PGP SIGNATURE----- _______________________________________________ Socketcan-core mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-core
