From: Andrew Morton <akpm@osdl.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, trini@kernel.crashing.org
Subject: Re: [patch 2/2] Validate and sanitze itimer timeval from userspace
Date: Sun, 19 Mar 2006 22:13:22 -0800 [thread overview]
Message-ID: <20060319221322.3e01f4fe.akpm@osdl.org> (raw)
In-Reply-To: <20060319102013.976854000@localhost.localdomain>
Thomas Gleixner <tglx@linutronix.de> wrote:
>
> +static void fixup_timeval(struct timeval *tv, int interval)
> +{
> ...
> + tmp = (unsigned long) tv->tv_usec;
> + if (tmp >= USEC_PER_SEC)
> + tv->tv_usec = USEC_PER_SEC - 1;
> +
> + tmp = (unsigned long) tv->tv_sec;
> + if (tmp > (LONG_MAX >> 1))
> + tv->tv_sec = (LONG_MAX >> 1);
> +}
Earlier kernels normalised the time, but this code truncates it.
For compatibility, shouldn't we be doing
tv->tv_sec += tv->tv_usec / USEC_PER_SEC;
?
prev parent reply other threads:[~2006-03-20 6:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-19 20:02 [patch 0/2] sys_setitimer and sys_alarm hotfixes (take #2) Thomas Gleixner
2006-03-19 20:02 ` [patch 1/2] sys_alarm() unsigned signed conversion fixup Thomas Gleixner
2006-03-20 6:06 ` Andrew Morton
2006-03-19 20:02 ` [patch 2/2] Validate and sanitze itimer timeval from userspace Thomas Gleixner
2006-03-20 6:13 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060319221322.3e01f4fe.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=trini@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome