Re: [openib-general] integer overflow

2007-02-10 Thread Roland Dreier
 > Yes but we cast them to signed int here - no?

That's true, I guess it is technically undefined.  But time_after() is
relying on the same thing working, so I would say we don't care.

 - R.

___
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general



Re: [openib-general] integer overflow

2007-02-10 Thread Michael S. Tsirkin
> Quoting Roland Dreier <[EMAIL PROTECTED]>:
> Subject: Re: integer overflow
> 
>  >while ((int) priv->tx_tail - (int) priv->tx_head < 0) {
>  > 
>  > seems to rely on integer overflow which seems to be
>  > undefined behaviour.
> 
> tx_tail and tx_head are unsigned, and overflow is defined for unsigned
> integers.

Yes but we cast them to signed int here - no?


-- 
MST

___
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general



Re: [openib-general] integer overflow

2007-02-10 Thread Roland Dreier
 >  while ((int) priv->tx_tail - (int) priv->tx_head < 0) {
 > 
 > seems to rely on integer overflow which seems to be
 > undefined behaviour.

tx_tail and tx_head are unsigned, and overflow is defined for unsigned
integers.

 - R.

___
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general



[openib-general] integer overflow

2007-02-10 Thread Michael S. Tsirkin
Roland, the following code in ipoib:

while ((int) priv->tx_tail - (int) priv->tx_head < 0) {

seems to rely on integer overflow which seems to be
undefined behaviour.

Should we care?

-- 
MST

___
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general