[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZRm/myTwrv1MqHAn@hoboy.vegasvil.org>
Date: Sun, 1 Oct 2023 11:51:07 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Simon Horman <horms@...nel.org>
Cc: Xabier Marquiegui <reibax@...il.com>, netdev@...r.kernel.org,
chrony-dev@...ony.tuxfamily.org, mlichvar@...hat.com,
ntp-lists@...tcorallo.com, vinicius.gomes@...el.com,
alex.maftei@....com, davem@...emloft.net, rrameshbabu@...dia.com,
shuah@...nel.org
Subject: Re: [PATCH net-next v3 3/3] ptp: support event queue reader channel
masks
On Sun, Oct 01, 2023 at 05:12:02PM +0200, Simon Horman wrote:
> > @@ -169,19 +170,28 @@ long ptp_ioctl(struct posix_clock_user *pcuser, unsigned int cmd,
> > {
> > struct ptp_clock *ptp =
> > container_of(pcuser->clk, struct ptp_clock, clock);
> > + struct ptp_tsfilter tsfilter_set, *tsfilter_get = NULL;
> > struct ptp_sys_offset_extended *extoff = NULL;
> > struct ptp_sys_offset_precise precise_offset;
> > struct system_device_crosststamp xtstamp;
> > struct ptp_clock_info *ops = ptp->info;
> > struct ptp_sys_offset *sysoff = NULL;
> > + struct timestamp_event_queue *tsevq;
> > struct ptp_system_timestamp sts;
> > struct ptp_clock_request req;
> > struct ptp_clock_caps caps;
> > struct ptp_clock_time *pct;
> > + int lsize, enable, err = 0;
> > unsigned int i, pin_index;
> > struct ptp_pin_desc pd;
> > struct timespec64 ts;
> > - int enable, err = 0;
> > +
> > + tsevq = pcuser->private_clkdata;
> > +
> > + if (tsevq->close_req) {
> > + err = -EPIPE;
> > + return err;
> > + }
>
> Here tseqv is dereferenced unconditionally...
Which is correct because the pointer is always set during open().
>
> >
> > switch (cmd) {
> >
> > @@ -481,6 +491,79 @@ long ptp_ioctl(struct posix_clock_user *pcuser, unsigned int cmd,
> > mutex_unlock(&ptp->pincfg_mux);
> > break;
> >
> > + case PTP_FILTERCOUNT_REQUEST:
> > + /* Calculate amount of device users */
> > + if (tsevq) {
>
> ... but here it is assumed that tseqv might be NULL.
Which is incorrect. The test is pointless.
Thanks,
Richard
Powered by blists - more mailing lists