From: Miroslav Lichvar <mlichvar@redhat.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
John Stultz <jstultz@google.com>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] ptp: Limit time setting of PTP clocks
Date: Tue, 10 Sep 2024 14:00:49 +0200 [thread overview]
Message-ID: <ZuA08ew8aNb8P_n4@localhost> (raw)
In-Reply-To: <Zt8YyCrQL1XBQk0g@hoboy.vegasvil.org>
On Mon, Sep 09, 2024 at 08:48:24AM -0700, Richard Cochran wrote:
> > diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> > index c56cd0f63909..bd7c5f534be6 100644
> > --- a/drivers/ptp/ptp_clock.c
> > +++ b/drivers/ptp/ptp_clock.c
> > @@ -100,6 +100,9 @@ static int ptp_clock_settime(struct posix_clock *pc, const struct timespec64 *tp
> > return -EBUSY;
> > }
> >
> > + if (!timespec64_valid_settod(tp))
> > + return -EINVAL;
>
> Why not perform the test earlier, in SYSCALL_DEFINE2(clock_settime, ...) ?
It would be more code as there are also the 32-bit compat variants of
the functions. The adjtime function would probably need to handle
missing gettime.
The limit would apply to all clocks, not just PTP clocks. If nothing
else, I suspect it would change returned errors for other clocks
trying to set the an unacceptable timespec value.
--
Miroslav Lichvar
prev parent reply other threads:[~2024-09-10 12:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 13:09 [PATCH] ptp: Limit time setting of PTP clocks Miroslav Lichvar
2024-09-09 15:48 ` Richard Cochran
2024-09-10 12:00 ` 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=ZuA08ew8aNb8P_n4@localhost \
--to=mlichvar@redhat.com \
--cc=arnd@arndb.de \
--cc=jstultz@google.com \
--cc=linux-kernel@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 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.