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.

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

Reply via email to