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/ipv4/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/ipv4/raw.c')
-rw-r--r-- | net/ipv4/raw.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index ebb1e5848bc6..757c9171e7c2 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -741,7 +741,7 @@ out: return ret; | |||
741 | } | 741 | } |
742 | 742 | ||
743 | static int do_raw_setsockopt(struct sock *sk, int level, int optname, | 743 | static int do_raw_setsockopt(struct sock *sk, int level, int optname, |
744 | char __user *optval, int optlen) | 744 | char __user *optval, unsigned int optlen) |
745 | { | 745 | { |
746 | if (optname == ICMP_FILTER) { | 746 | if (optname == ICMP_FILTER) { |
747 | if (inet_sk(sk)->num != IPPROTO_ICMP) | 747 | if (inet_sk(sk)->num != IPPROTO_ICMP) |
@@ -753,7 +753,7 @@ static int do_raw_setsockopt(struct sock *sk, int level, int optname, | |||
753 | } | 753 | } |
754 | 754 | ||
755 | static int raw_setsockopt(struct sock *sk, int level, int optname, | 755 | static int raw_setsockopt(struct sock *sk, int level, int optname, |
756 | char __user *optval, int optlen) | 756 | char __user *optval, unsigned int optlen) |
757 | { | 757 | { |
758 | if (level != SOL_RAW) | 758 | if (level != SOL_RAW) |
759 | return ip_setsockopt(sk, level, optname, optval, optlen); | 759 | return ip_setsockopt(sk, level, optname, optval, optlen); |
@@ -762,7 +762,7 @@ static int raw_setsockopt(struct sock *sk, int level, int optname, | |||
762 | 762 | ||
763 | #ifdef CONFIG_COMPAT | 763 | #ifdef CONFIG_COMPAT |
764 | static int compat_raw_setsockopt(struct sock *sk, int level, int optname, | 764 | static int compat_raw_setsockopt(struct sock *sk, int level, int optname, |
765 | char __user *optval, int optlen) | 765 | char __user *optval, unsigned int optlen) |
766 | { | 766 | { |
767 | if (level != SOL_RAW) | 767 | if (level != SOL_RAW) |
768 | return compat_ip_setsockopt(sk, level, optname, optval, optlen); | 768 | return compat_ip_setsockopt(sk, level, optname, optval, optlen); |