All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miroslav Lichvar <mlichvar@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: 维康石 <swkhack@gmail.com>, "John Stultz" <john.stultz@linaro.org>,
	sboyd@kernel.org, LKML <linux-kernel@vger.kernel.org>,
	swkhack@qq.com
Subject: Re: [PATCH] time: fix a assignment error in ntp module
Date: Mon, 17 Jun 2019 15:21:33 +0200	[thread overview]
Message-ID: <20190617132133.GA7851@localhost> (raw)
In-Reply-To: <alpine.DEB.2.21.1906171409250.1854@nanos.tec.linutronix.de>

On Mon, Jun 17, 2019 at 02:14:57PM +0200, Thomas Gleixner wrote:
> On Mon, 17 Jun 2019, 维康石 wrote:
> > Yes,the  >UINT_MAX value can be passed by
> > syscall adjtimex->do_adjtimex->__do_adjtimex->process_adjtimex_modes by the
> > proper arugments.
> 
> So there is clearly some sanity check missing, but surely not that
> type cast.

As the offset is saved in an int (and returned via adjtimex() in the
tai field), should be the maximum INT_MAX?

We probably also want to avoid overflow in the offset on a leap second
and the CLOCK_TAI clock itself, so maybe it would make sense to
specify a much smaller maximum like 1000000?

Even 1000 should be good enough for near future. Negative values are
not allowed anyway. If the Earth's rotation changed significantly
(e.g. hitting a very large asteroid), there probably wouldn't be
anyone left to care about TAI. 

-- 
Miroslav Lichvar

  reply	other threads:[~2019-06-17 13:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22  9:34 [PATCH] time: fix a assignment error in ntp module Weikang shi
2019-04-24 20:22 ` Thomas Gleixner
2019-06-17  7:21 ` Thomas Gleixner
     [not found]   ` <CAObeVcdBDbSiyQCX7C_G3p6TpB9yjRyrWwsvPgh11V8v+BNaqQ@mail.gmail.com>
2019-06-17 12:14     ` Thomas Gleixner
2019-06-17 13:21       ` Miroslav Lichvar [this message]
2019-06-17 15:06         ` 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=20190617132133.GA7851@localhost \
    --to=mlichvar@redhat.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=swkhack@gmail.com \
    --cc=swkhack@qq.com \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.