diff options
author | David S. Miller <davem@davemloft.net> | 2009-09-30 19:12:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-30 19:12:20 -0400 |
commit | b7058842c940ad2c08dd829b21e5c92ebe3b8758 (patch) | |
tree | 5fe78d599fc345ca0bcd4b083b79095a54b2921b /net/ipv6/raw.c | |
parent | eb1cf0f8f7a9e5a6d573d5bd72c015686a042db0 (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/raw.c')
-rw-r--r-- | net/ipv6/raw.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 7d675b8d82d3..4f24570b0869 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -957,7 +957,7 @@ static int rawv6_geticmpfilter(struct sock *sk, int level, int optname, | |||
957 | 957 | ||
958 | 958 | ||
959 | static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, | 959 | static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, |
960 | char __user *optval, int optlen) | 960 | char __user *optval, unsigned int optlen) |
961 | { | 961 | { |
962 | struct raw6_sock *rp = raw6_sk(sk); | 962 | struct raw6_sock *rp = raw6_sk(sk); |
963 | int val; | 963 | int val; |
@@ -1000,7 +1000,7 @@ static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | static int rawv6_setsockopt(struct sock *sk, int level, int optname, | 1002 | static int rawv6_setsockopt(struct sock *sk, int level, int optname, |
1003 | char __user *optval, int optlen) | 1003 | char __user *optval, unsigned int optlen) |
1004 | { | 1004 | { |
1005 | switch(level) { | 1005 | switch(level) { |
1006 | case SOL_RAW: | 1006 | case SOL_RAW: |
@@ -1024,7 +1024,7 @@ static int rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
1024 | 1024 | ||
1025 | #ifdef CONFIG_COMPAT | 1025 | #ifdef CONFIG_COMPAT |
1026 | static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname, | 1026 | static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname, |
1027 | char __user *optval, int optlen) | 1027 | char __user *optval, unsigned int optlen) |
1028 | { | 1028 | { |
1029 | switch (level) { | 1029 | switch (level) { |
1030 | case SOL_RAW: | 1030 | case SOL_RAW: |