[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250827173708.398bdb99@kernel.org>
Date: Wed, 27 Aug 2025 17:37:08 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Miroslav Lichvar <mlichvar@...hat.com>
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 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.
Do we not need to apply the same treatment to adjphase?
--
pw-bot: cr
Powered by blists - more mailing lists