Messages in this thread | | | Date | Wed, 20 Feb 2013 14:08:23 -0800 | From | Tejun Heo <> | Subject | Re: [PATCH] posix-timer: don't call idr_find() w/ negative ID |
| |
On Wed, Feb 20, 2013 at 02:05:51PM -0800, Andrew Morton wrote: > Sure, it's unlikely to cause a problem in practice. Maybe five years > from now, after idr has been cleaned up and switched to 64-bit, we've > left a little hand grenade for someone. It would be good to > future-safe it in some fashion. > > I wonder if we should add some generic facility to handle this: > > /* > * Query whether an unsigned type is `negative' when we don't know its size > */ > #define msb_is_set(v) { implementation goes here ;) } > > Maybe not justified, dunno...
The thing is it's not only about MSB. Any bits beyond 1 << 31 are problematic, so we want a range test.
Thanks.
-- tejun
| |