Subject: Re: [RFC PATCH 04/10] net: dsa: mv88e6xxx: expose switch time as a PTP hardware clock

From: Andrew Lunn <[email-masked]>
Date: Fri, 9 Feb 2018 22:04:59 +0100

On Fri, Feb 09, 2018 at 12:33:36PM -0800, Richard Cochran wrote:
> On Sat, Feb 03, 2018 at 10:40:08PM +0100, Andrew Lunn wrote:
> > +static int mv88e6xxx_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
> > +{
> > +	struct mv88e6xxx_chip *chip = ptp_to_chip(ptp);
> > +	int neg_adj = 0;
> > +	u32 diff, mult;
> > +	u64 adj;
> > +
> > +	if (scaled_ppm < 0) {
> > +		neg_adj = 1;
> > +		scaled_ppm = -scaled_ppm;
> > +	}
> > +	mult = CC_MULT;
> > +	adj = scaled_ppm * CC_MULT_NUM;
>               ^^^^^^^^^^^^^^^^^^^^^^^^
> This easily overflows on 32 bit platforms.  My bad.  Fix below...

Hi Richard

Thanks, i will squash the fix in for the next version.

	Andrew