Re: [patch 2/2] alarm unsigned signed conversion fixup
From: Thomas Gleixner
Date: Sat Mar 18 2006 - 15:24:19 EST
On Sat, 2006-03-18 at 12:12 -0800, Andrew Morton wrote:
> Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> > alarm() calls the kernel with an unsigend int timeout in seconds.
> > The value is converted to a timeval which is used to setup the
> > itimer. The tv_sec field of the timeval is a long, which causes
> > the timeout to be negative on 32 bit machines if seconds > INT_MAX.
> > Also this was silently caught before the hrtimer merge.
> > To avoid fixups all over the place the duplicated sys_alarm code
> > is moved to itimer.c.
> It's not clear what you mean by this. What does "silently caught" mean?
> I _think_ you mean "a negative tv_sec gets treated in a random fashion, but
> with my preceding patch it will incorrectly get -EINVAL, so fix things to
> accept this large tv_sec". Or something else.
> Please clarify.
> What happens if change sys_setitimer() to normalise the incoming timeval as
> I suggested? I guess that doesn't affect this..
No, because a negative value does not become positive by normalizing.
Well except you build a normalizing function which converts negative
values to INT_MAX.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/