[openib-general] integer overflow

Michael S. Tsirkin mst at mellanox.co.il
Sat Feb 10 15:59:35 PST 2007


> Quoting Roland Dreier <rdreier at cisco.com>:
> 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




More information about the general mailing list