From: Miroslav Lichvar <mlichvar@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org,
Richard Cochran <richardcochran@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
John Stultz <jstultz@google.com>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH RESEND net-next] ptp: Limit time setting of PTP clocks
Date: Thu, 28 Aug 2025 12:11:48 +0200 [thread overview]
Message-ID: <aLArZFRxZ0AjKoRk@localhost> (raw)
In-Reply-To: <20250827173708.398bdb99@kernel.org>
On Wed, Aug 27, 2025 at 05:37:08PM -0700, Jakub Kicinski wrote:
> On Mon, 25 Aug 2025 13:11:13 +0200 Miroslav Lichvar wrote:
> > - if ((unsigned long) ts.tv_nsec >= NSEC_PER_SEC)
> > + /* Make sure the offset is valid */
> > + err = ptp_clock_gettime(pc, &ts2);
> > + if (err)
> > + return err;
> > + ts2 = timespec64_add(ts2, ts);
> > +
> > + if ((unsigned long) ts.tv_nsec >= NSEC_PER_SEC ||
> > + !timespec64_valid_settod(&ts2))
> > return -EINVAL;
>
> Please leave the input validation (tv_nsec >= NSEC_PER_SEC)
> separate and before we call gettime. It's easy to miss that
> on part of the condition is checking ts and the other ts2.
Ok, I'll send a v2.
> Do we not need to apply the same treatment to adjphase?
No, those phase adjustments are very small (sub-second) and slow. They
don't cause a step in time, only the frequency. The value is already
checked against the maximum provided by the driver.
Thanks,
--
Miroslav Lichvar
prev parent reply other threads:[~2025-08-28 10:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 11:11 [PATCH RESEND net-next] ptp: Limit time setting of PTP clocks Miroslav Lichvar
2025-08-28 0:37 ` Jakub Kicinski
2025-08-28 10:11 ` Miroslav Lichvar [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=aLArZFRxZ0AjKoRk@localhost \
--to=mlichvar@redhat.com \
--cc=arnd@arndb.de \
--cc=jstultz@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.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 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).