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:	Fri, 25 Jul 2008 01:42:52 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	ben-linux@...ff.org
Cc:	bzolnier@...il.com, harvey.harrison@...il.com,
	linux-ide@...nel.org, linux-kernel@...r.kernel.org,
	torvalds@...ux-foundation.org
Subject: Re: recent IDE regression

From: Ben Dooks <ben-linux@...ff.org>
Date: Fri, 25 Jul 2008 09:34:48 +0100

> On Thu, Jul 24, 2008 at 11:38:31PM -0700, David Miller wrote:
> > diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
> > index 07da5fb..8aae917 100644
> > --- a/drivers/ide/ide-iops.c
> > +++ b/drivers/ide/ide-iops.c
> > @@ -510,10 +510,8 @@ void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
> >  
> >  	if (byteswap) {
> >  		/* convert from big-endian to host byte order */
> > -		for (p = end ; p != s;) {
> > -			unsigned short *pp = (unsigned short *) (p -= 2);
> > -			*pp = ntohs(*pp);
> > -		}
> > +		for (p = end ; p != s;)
> > +			be16_to_cpus((u16 *)(p -= 2));
> 
> personally, i would much prefer to see the loop being less evil
> like:
> 
> 	for (p = s; p < end; p += 2)
> 		be16_to_cpus((u16 *)p);
> 
> is there an architecture/compiler combo which really makes this
> evil worthwile? on arm (gcc 4.2), both evaluate to the same number of
> instructions.

Regardless of what we want to do with this ugly loop, the endianness
macros should be fixed to consistently evaluate their arguments
once just like real function calls do.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ