lkml.org 
[lkml]   [2013]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] posix-timer: don't call idr_find() w/ negative ID
On Wed, 20 Feb 2013, Andrew Morton wrote:
> On Wed, 20 Feb 2013 13:37:01 -0800
> Tejun Heo <tj@kernel.org> wrote:
> > hopefully with some comments. That said, if I'm grepping it right,
> > all archs define timer_t as int, so maybe we're just being paranoid.
> >
>
> 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...

First of all the compiler should warn you about the truncation. And
aside of that:

+ BUILD_BUG_ON(sizeof(timer_t) != sizeof(int));

and then we can worry about that esoteric architecture when that thing
triggers?

Aside of that, due to the pending checkpoint/restore stuff this user
might be gone in the near future.

Thanks,

tglx



\
 
 \ /
  Last update: 2013-02-21 01:02    [W:0.130 / U:1.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site