aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/udp.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-09-30 19:12:20 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-30 19:12:20 -0400
commitb7058842c940ad2c08dd829b21e5c92ebe3b8758 (patch)
tree5fe78d599fc345ca0bcd4b083b79095a54b2921b /net/ipv6/udp.c
parenteb1cf0f8f7a9e5a6d573d5bd72c015686a042db0 (diff)
net: Make setsockopt() optlen be unsigned.
This provides safety against negative optlen at the type level instead of depending upon (sometimes non-trivial) checks against this sprinkled all over the the place, in each and every implementation. Based upon work done by Arjan van de Ven and feedback from Linus Torvalds. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r--net/ipv6/udp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index b265b7047d3..3a60f12b34e 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1044,7 +1044,7 @@ void udpv6_destroy_sock(struct sock *sk)
1044 * Socket option code for UDP 1044 * Socket option code for UDP
1045 */ 1045 */
1046int udpv6_setsockopt(struct sock *sk, int level, int optname, 1046int udpv6_setsockopt(struct sock *sk, int level, int optname,
1047 char __user *optval, int optlen) 1047 char __user *optval, unsigned int optlen)
1048{ 1048{
1049 if (level == SOL_UDP || level == SOL_UDPLITE) 1049 if (level == SOL_UDP || level == SOL_UDPLITE)
1050 return udp_lib_setsockopt(sk, level, optname, optval, optlen, 1050 return udp_lib_setsockopt(sk, level, optname, optval, optlen,
@@ -1054,7 +1054,7 @@ int udpv6_setsockopt(struct sock *sk, int level, int optname,
1054 1054
1055#ifdef CONFIG_COMPAT 1055#ifdef CONFIG_COMPAT
1056int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, 1056int compat_udpv6_setsockopt(struct sock *sk, int level, int optname,
1057 char __user *optval, int optlen) 1057 char __user *optval, unsigned int optlen)
1058{ 1058{
1059 if (level == SOL_UDP || level == SOL_UDPLITE) 1059 if (level == SOL_UDP || level == SOL_UDPLITE)
1060 return udp_lib_setsockopt(sk, level, optname, optval, optlen, 1060 return udp_lib_setsockopt(sk, level, optname, optval, optlen,