[ofa-general] Re: [PATCH for-2.6.22] IB/cm: improve local id allocation

Michael S. Tsirkin mst at dev.mellanox.co.il
Mon May 21 09:11:30 PDT 2007


> Quoting Roland Dreier <rdreier at cisco.com>:
> Subject: Re: [PATCH for-2.6.22] IB/cm: improve local id allocation
> 
> lib/idr.c says it returns positive IDs always (actually the comments
> say "in the range 0 ... 0x7fffffff").  So I guess we would want
> something like:
> 
> 	if (!ret)
> 		next_id = id == INT_MAX ? 0 : id + 1;

True, except INT_MAX isn't defined in kernel headers I think,
so I just put 0x7fffffff there.

> (current code has a similar bug, plus exposes undefined behavior of
> signed overflow).


-- 
MST



More information about the general mailing list