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:	Sat, 08 Jan 2011 11:20:05 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Jarek Poplawski <jarkao2@...il.com>
Cc:	David Miller <davem@...emloft.net>, xiaosuo@...il.com,
	paulus@...ba.org, harvey.harrison@...il.com,
	linux-ppp@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v2] net: ppp: use {get,put}_unaligned_be{16,32}

Le samedi 08 janvier 2011 à 11:04 +0100, Jarek Poplawski a écrit :

> Just for the record: I agree with Paul that current code is more readable.
> This code still requires thinking about specific bytes and the patch mixes
> it only with word access.
> 
> Jarek P.
> 
> > @@ -395,16 +396,14 @@ mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf,
> >  	 */
> >  	obuf[0] = PPP_ADDRESS(ibuf);
> >  	obuf[1] = PPP_CONTROL(ibuf);
> > -	obuf[2] = PPP_COMP >> 8;	/* isize + MPPE_OVHD + 1 */
> > -	obuf[3] = PPP_COMP;	/* isize + MPPE_OVHD + 2 */
> > +	put_unaligned_be16(PPP_COMP, obuf + 2);
> >  	obuf += PPP_HDRLEN;

Compilers are stupid not generating optimal code, so we should help them
a bit.

Yes, I agree this is ugly Jarek and makes reading of this code a bit
more complex, but this is a move we cannot stop. Number of functions,
macros, etc... is exploding and we must follow the trend ;)

41 c6 44 24 02 00       movb   $0x0,0x2(%r12)
41 c6 44 24 03 fd       movb   $0xfd,0x3(%r12)

After patch :

66 41 c7 44 24 02 00 fd   movw   $0xfd00,0x2(%r12)



--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ