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: <AE90C24D6B3A694183C094C60CF0A2F6026B709E@saturn3.aculab.com>
Date:	Mon, 12 Nov 2012 13:54:11 -0000
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"David Miller" <davem@...emloft.net>, <xi.wang@...il.com>
Cc:	<netdev@...r.kernel.org>
Subject: RE: [PATCH] ipv4: avoid undefined behavior in do_ip_setsockopt()

> >> This code is a fast bit test on purpose.  You're making the
> >> code slower.
> >
> > No, it's the opposite.  All modern compilers optimize switch cases
> > into a fast bit test.

'All modern' is probably an overstatement, 'recent gcc' might be valid.
 
> Indeed, I even checked sparc64 with gcc-4.6 and it looks good.
> 
> Thanks for the clarification, I'll apply this, thanks.

The 'switch' version will have an extra conditional to detect
'out of range' values - even though we know they can't happen.
I'm not sure you can avoid that - even for an enum.

	David



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