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] [day] [month] [year] [list]
Date:	Tue, 12 Feb 2013 09:19:52 -0000
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"Ben Dooks" <ben.dooks@...ethink.co.uk>,
	"Ben Hutchings" <bhutchings@...arflare.com>
Cc:	<netdev@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
	"Rob Herring" <rob.herring@...xeda.com>,
	<linux-arm-kernel@...ts.infradead.org>
Subject: RE: [PATCH 2/2] net: calexdaxgmac: fixup endian issues after __raw IO function change

> > You are using le32_to_cpu() and cpu_to_le32() the wrong way round, and
> > then putting casts on the wrong side, i.e. it should be:
> >
> > 	value = le32_to_cpu((__force __le32)__raw_readl(addr));
> > 	__raw_writel((__force u32)cpu_to_le32(value), addr);
> >
> > (I do wonder why __raw I/O functions aren't declared to take/return __le
> > types... it would avoid the need to cast altogether.)
> 
> Because they do things with the order the cpu is working in, the
> read{x} and write{x} transfer cpu to bus-endian so returning an __le
> type would not be correct.

Surely you want to arrange to use the byte-swapping memory
read/write instructions, rather than byteswapping the value.

Particularly on ppc which doesn't have a byteswap instruction
but can do byteswapping memory accesses.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ