Subject: Re: [PATCH V6 net-next 11/11] ptp: Add a driver for InES time stamping IP core.

From: Richard Cochran <[email-masked]>
Date: Mon, 16 Dec 2019 20:34:33 -0800

On Mon, Dec 16, 2019 at 04:11:14PM -0800, Jakub Kicinski wrote:
> On Mon, 16 Dec 2019 08:13:26 -0800, Richard Cochran wrote:
> > +	clkid = (u64 *)(data + offset + OFF_PTP_CLOCK_ID);
> > +	portn = (u16 *)(data + offset + OFF_PTP_PORT_NUM);
> > +	seqid = (u16 *)(data + offset + OFF_PTP_SEQUENCE_ID);
> 
> These should perhaps be __be types?
> 
> Looks like there is a few other sparse warnings in ptp_ines.c, would
> you mind addressing those?

I saw the sparse warnings before (from one of the robots), but I
decided that they are false positives.  Or perhaps I don't appreciate
what the warnings mean...

Take the 'clkid' pointer for example:
 
> > +	if (cpu_to_be64(ts->clkid) != *clkid) {
> > +		pr_debug("clkid mismatch ts %llx != skb %llx\n",
> > +			 cpu_to_be64(ts->clkid), *clkid);
> > +		return false;
> > +	}

The field that to which 'clkid' points is in network byte order.  The
code correctly converts ts->clkid (in CPU byte order) to network byte
order before comparing it with the field.

So where is the error?

Thanks,
Richard