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]
Message-ID: <af9a7011-1258-dc87-af59-2ceac4388f83@gmail.com>
Date:   Wed, 4 Jan 2017 13:27:00 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Andrew Lunn <andrew@...n.ch>, David Miller <davem@...emloft.net>
Cc:     volodymyr.bendiuga@...il.com, vivien.didelot@...oirfairelinux.com,
        netdev@...r.kernel.org
Subject: Re: [PATCH repost net-next] dsa: mv88e6xxx: Optimise atu_get

On 01/04/2017 01:19 PM, Andrew Lunn wrote:
> On Wed, Jan 04, 2017 at 04:11:03PM -0500, David Miller wrote:
>> From: Andrew Lunn <andrew@...n.ch>
>> Date: Wed,  4 Jan 2017 19:56:24 +0100
>>
>>> +static inline u64 ether_addr_to_u64(const u8 *addr)
>>> +{
>>> +	u64 u = 0;
>>> +	int i;
>>> +
>>> +	for (i = 0; i < ETH_ALEN; i++)
>>> +		u = u << 8 | addr[i];
>>> +
>>> +	return u;
>>> +}
>>  ...
>>> +static inline void u64_to_ether_addr(u64 u, u8 *addr)
>>> +{
>>> +	int i;
>>> +
>>> +	for (i = ETH_ALEN - 1; i >= 0; i--) {
>>> +		addr[i] = u & 0xff;
>>> +		u = u >> 8;
>>> +	}
>>> +}
>>
>> I think these two routines behave differently on big vs little
>> endian.  And I doubt this was your intention.
> 
> I don't have a big endian system to test on.

You could build the driver for e.g: a MIPS Malta board and use the
qemu-system-mips to validate this, there could be a way to do that on
ARM too although it's a different kind of BE (BE8 vs. BE32) AFAIR.

> 
> I tried to avoid the usual pitfalls. I don't cast a collection of
> bytes to a u64, which i know has no chance of working. Accessing a MAC
> address as a byte array should be endian safe. The shift operation
> should also be endian safe.
> 
> What exactly do you think will behave differently?
> 
>      Andrew
> 


-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ