[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150416075633.GA7968@localhost>
Date: Thu, 16 Apr 2015 09:56:33 +0200
From: Miroslav Lichvar <mlichvar@...hat.com>
To: Justin Keller <justincompsci@...il.com>
Cc: linux-kernel@...r.kernel.org, John Stultz <john.stultz@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Prarit Bhargava <prarit@...hat.com>,
Richard Cochran <richardcochran@...il.com>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [RFC][PATCH] timekeeping: Limit system time to prevent 32-bit
time_t overflow
On Wed, Apr 15, 2015 at 12:17:36PM -0400, Justin Keller wrote:
> Is there a reason for "step = leap"?
It's there to not change the behavior when a leap second occurs, the
clock still needs to be stepped. I guess it could be optimized a bit,
if it used "if (unlikely(leap || tk->xtime_sec >= time_max_sec))", the
64-bit step variable wouldn't have to be used in normal operation.
> > /* Figure out if its a leap sec and apply if needed */
> > leap = second_overflow(tk->xtime_sec);
> > - if (unlikely(leap)) {
> > + step = leap;
> > +
> > + /* If the system time reached the maximum, step it back */
> > + if (unlikely(tk->xtime_sec >= time_max_sec)) {
> > + step = time_max_sec - tk->xtime_sec - SEC_PER_WEEK;
> > + printk(KERN_NOTICE
> > + "Clock: maximum time reached, stepping back\n");
> > + }
> > +
> > + if (unlikely(step)) {
> > struct timespec64 ts;
> >
> > - tk->xtime_sec += leap;
> > + tk->xtime_sec += step;
--
Miroslav Lichvar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists