lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 24 Apr 2022 18:19:31 -0700
From:   Richard Cochran <richardcochran@...il.com>
To:     Jonathan Lemon <jonathan.lemon@...il.com>
Cc:     f.fainelli@...il.com, bcm-kernel-feedback-list@...adcom.com,
        andrew@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
        netdev@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH net-next v1 1/4] net: phy: broadcom: Add PTP support for
 some Broadcom PHYs.

On Sat, Apr 23, 2022 at 07:23:53PM -0700, Jonathan Lemon wrote:

> +static bool bcm_ptp_rxtstamp(struct mii_timestamper *mii_ts,
> +			     struct sk_buff *skb, int type)
> +{
> +	struct bcm_ptp_private *priv = mii2priv(mii_ts);
> +	struct skb_shared_hwtstamps *hwts;
> +	struct ptp_header *header;
> +	u32 sec, nsec;
> +	u8 *data;
> +
> +	if (!priv->hwts_rx)
> +		return false;
> +
> +	header = ptp_parse_header(skb, type);
> +	if (!header)
> +		return false;
> +
> +	data = (u8 *)(header + 1);

No need to pointer math, as ptp_header already has reserved1 and reserved2.

> +	sec = get_unaligned_be32(data);

Something is missing here.  The seconds field is only four bits, so
the code needs to read the 80 bit counter once in a while and augment
the time stamp with the upper bits.

> +	nsec = get_unaligned_be32(data + 4);
> +
> +	hwts = skb_hwtstamps(skb);
> +	hwts->hwtstamp = ktime_set(sec, nsec);
> +
> +	return false;
> +}

Thanks,
Richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ