public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Justin Stitt <justinstitt@google.com>
Cc: John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Bill Wendling <morbo@google.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	linux-hardening@vger.kernel.org,
	Miroslav Lichvar <mlichvar@redhat.com>
Subject: Re: [PATCH v2] ntp: remove accidental integer wrap-around
Date: Sat, 25 May 2024 00:54:21 +0200	[thread overview]
Message-ID: <87le3yddnm.ffs@tglx> (raw)
In-Reply-To: <CAFhGd8o0eFh0sqXtOcw=E+WBaKCTatpv18fA1Pzr_M1aC9OQ=A@mail.gmail.com>

Justin!

On Fri, May 24 2024 at 15:43, Justin Stitt wrote:
> I appreciate you reviewing my patches.

You're welcome!

> On Fri, May 24, 2024 at 5:09 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>> So instead of turning the clock back, we might be better off to actually
>> put the normalization in place at the assignment:
>>
>>     time_maxerror = min(max(0, txc->maxerror), NTP_PHASE_LIMIT);
>
> A saturating resolution strategy is one that I've taken with some of
> my other overflow patches.
>
> ... but how about: clamp(txc->maxerror, 0, NTP_PHASE_LIMIT)

Duh. You are right, but that's too obvious :)

Thanks,

        tglx

  reply	other threads:[~2024-05-24 22:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 20:22 [PATCH v2] ntp: remove accidental integer wrap-around Justin Stitt
2024-05-24 12:09 ` Thomas Gleixner
2024-05-24 12:44   ` Thomas Gleixner
2024-05-27  8:26     ` Miroslav Lichvar
2024-05-29  8:18       ` Thomas Gleixner
2024-05-24 22:43   ` Justin Stitt
2024-05-24 22:54     ` Thomas Gleixner [this message]
2024-08-05 14:22 ` [tip: timers/urgent] ntp: Clamp maxerror and esterror to operating range tip-bot2 for Justin Stitt

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=87le3yddnm.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=jstultz@google.com \
    --cc=justinstitt@google.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mlichvar@redhat.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=sboyd@kernel.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