From: Miroslav Lichvar <mlichvar@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Ondrej Mosnacek <omosnace@redhat.com>,
Roman Zippel <zippel@linux-m68k.org>,
John Stultz <john.stultz@linaro.org>,
Stephen Boyd <sboyd@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: kernel/time/ntp.c: Possible off-by-one error in TAI range check?
Date: Mon, 15 Apr 2019 10:56:41 +0200 [thread overview]
Message-ID: <20190415085641.GI28203@localhost> (raw)
In-Reply-To: <alpine.DEB.2.21.1904151008460.1729@nanos.tec.linutronix.de>
On Mon, Apr 15, 2019 at 10:09:43AM +0200, Thomas Gleixner wrote:
> > On Mon, Apr 8, 2019 at 10:47 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> > > Commit 153b5d054ac2 ("ntp: support for TAI") added a possibility to
> > > change the TAI offset from userspace via adjtimex(2). The code checks
> > > if the input value (txc->constant) is greater than 0 and if it is not,
> > > then it doesn't modify the value. Ignoring the fact that this check
> > > should probably be in timekeeping_validate_timex() and cause -EINVAL
> > > to be returned when false, I find it strange that the check doesn't
> > > allow to set the value to 0, which seems to be the default value...
> > >
> > > Was this behavior intended or should the code actually check for
> > > txc->constant >= 0 instead of txc->constant > 0?
I guess zero here means "unknown" and maybe the intention was to not
allow setting the offset to an unknown value once it has been set to a
valid value. The trouble is that after inserting a leap second the
offset may change from zero to one.
I think it should be changed to allow setting the offset to zero.
--
Miroslav Lichvar
next prev parent reply other threads:[~2019-04-15 8:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 8:47 kernel/time/ntp.c: Possible off-by-one error in TAI range check? Ondrej Mosnacek
2019-04-15 8:02 ` Ondrej Mosnacek
2019-04-15 8:09 ` Thomas Gleixner
2019-04-15 8:56 ` Miroslav Lichvar [this message]
2019-04-16 19:59 ` Thomas Gleixner
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=20190415085641.GI28203@localhost \
--to=mlichvar@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=zippel@linux-m68k.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;
as well as URLs for NNTP newsgroup(s).