[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87tv9zulto.fsf@gmail.com>
Date: Fri, 30 Aug 2019 10:57:55 +0300
From: Felipe Balbi <felipe.balbi@...ux.intel.com>
To: Richard Cochran <richardcochran@...il.com>
Cc: Christopher S Hall <christopher.s.hall@...el.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] PTP: introduce new versions of IOCTLs
Hi,
Richard Cochran <richardcochran@...il.com> writes:
>> @@ -139,11 +141,24 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
>> break;
>>
>> case PTP_EXTTS_REQUEST:
>> + case PTP_EXTTS_REQUEST2:
>> + memset(&req, 0, sizeof(req));
>> +
>> if (copy_from_user(&req.extts, (void __user *)arg,
>> sizeof(req.extts))) {
>> err = -EFAULT;
>> break;
>> }
>> + if ((req.extts.flags || req.extts.rsv[0] || req.extts.rsv[1])
>> + && cmd == PTP_EXTTS_REQUEST2) {
>> + err = -EINVAL;
>> + break;
>> + } else if (cmd == PTP_EXTTS_REQUEST) {
>> + req.extts.flags = 0;
>
> This still isn't quite right. Sorry that was my fault.
>
> The req.extts.flags can be (PTP_ENABLE_FEATURE | PTP_RISING_EDGE |
> PTP_FALLING_EDGE), and ENABLE is used immediately below in this case.
>
> Please #define those bits into a valid mask, and then:
>
> - for PTP_EXTTS_REQUEST2 check that ~mask is zero, and
> - for PTP_EXTTS_REQUEST clear the ~mask bits for the drivers.
>
> Thanks again for cleaning this up!
good point. This will actually reduce the size of the patch 2.
--
balbi
Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)
Powered by blists - more mailing lists