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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 5 Jun 2008 05:46:58 -0700
From:	Dale Farnsworth <dale@...nsworth.org>
To:	Lennert Buytenhek <buytenh@...tstofly.org>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH 37/39] mv643xx_eth: don't read from upper parts of
	64-bit mib registers

On Tue, Jun 03, 2008 at 01:02:52PM +0200, Lennert Buytenhek wrote:
> The two 64-bit MIB registers (good_octets_received and
> good_octets_sent) can trigger weird behavior if reads are done
> from their 32-bit top parts.  This patch avoids reading the top
> halves entirely.
> 
> Signed-off-by: Lennert Buytenhek <buytenh@...vell.com>
> ---
>  drivers/net/mv643xx_eth.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
> index 0f8e79f..54c9c76 100644
> --- a/drivers/net/mv643xx_eth.c
> +++ b/drivers/net/mv643xx_eth.c
> @@ -983,7 +983,7 @@ static void mib_counters_update(struct mv643xx_eth_private *mep)
>  	struct mib_counters *p = &mep->mib_counters;
>  
>  	p->good_octets_received += mib_read(mep, 0x00);
> -	p->good_octets_received += (u64)mib_read(mep, 0x04) << 32;
> +//	p->good_octets_received += (u64)mib_read(mep, 0x04) << 32;
>  	p->bad_octets_received += mib_read(mep, 0x08);
>  	p->internal_mac_transmit_err += mib_read(mep, 0x0c);
>  	p->good_frames_received += mib_read(mep, 0x10);
> @@ -997,7 +997,7 @@ static void mib_counters_update(struct mv643xx_eth_private *mep)
>  	p->frames_512_to_1023_octets += mib_read(mep, 0x30);
>  	p->frames_1024_to_max_octets += mib_read(mep, 0x34);
>  	p->good_octets_sent += mib_read(mep, 0x38);
> -	p->good_octets_sent += (u64)mib_read(mep, 0x3c) << 32;
> +//	p->good_octets_sent += (u64)mib_read(mep, 0x3c) << 32;
>  	p->good_frames_sent += mib_read(mep, 0x40);
>  	p->excessive_collision += mib_read(mep, 0x44);
>  	p->multicast_frames_sent += mib_read(mep, 0x48);

I'd add a comment referring to the weird behavior.  Also, aren't
C++-style comments discouraged?

-Dale
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists