summaryrefslogtreecommitdiff
path: root/net/xfrm
diff options
context:
space:
mode:
authorXi Wang <xi.wang@gmail.com>2012-11-11 11:20:01 +0000
committerBen Hutchings <ben@decadent.org.uk>2012-12-06 11:20:11 +0000
commit58fda05f80418cf457e3425d8b58b15262198398 (patch)
tree4731b60f2bf2ef7a39d35e8d6823cdc2567e0c62 /net/xfrm
parent5c1972f1b4f784560003075e05dcd95c1db8116e (diff)
ipv4: avoid undefined behavior in do_ip_setsockopt()
[ Upstream commit 0c9f79be295c99ac7e4b569ca493d75fdcc19e4e ] (1<<optname) is undefined behavior in C with a negative optname or optname larger than 31. In those cases the result of the shift is not necessarily zero (e.g., on x86). This patch simplifies the code with a switch statement on optname. It also allows the compiler to generate better code (e.g., using a 64-bit mask). Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net/xfrm')
0 files changed, 0 insertions, 0 deletions