[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aLArZFRxZ0AjKoRk@localhost>
Date: Thu, 28 Aug 2025 12:11:48 +0200
From: Miroslav Lichvar <mlichvar@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, Richard Cochran <richardcochran@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
John Stultz <jstultz@...gle.com>, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH RESEND net-next] ptp: Limit time setting of PTP clocks
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
Powered by blists - more mailing lists