diff options
author | roel kluin <roel.kluin@gmail.com> | 2009-10-23 01:59:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-29 04:39:54 -0400 |
commit | 65a1c4fffaaf5ca166a1263d84ca664d5192cda6 (patch) | |
tree | 4b78359d2af0a8e0912addbdff6fa07856f25f95 /net | |
parent | 091bb8ab51c668635d1a75359019005921676881 (diff) |
net: Cleanup redundant tests on unsigned
optlen is unsigned so the `< 0' test is never true.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/can/raw.c | 2 | ||||
-rw-r--r-- | net/compat.c | 3 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 2 |
3 files changed, 1 insertions, 6 deletions
diff --git a/net/can/raw.c b/net/can/raw.c index 962fc9f1d0c7..6e77db58b9e6 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -424,8 +424,6 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, | |||
424 | 424 | ||
425 | if (level != SOL_CAN_RAW) | 425 | if (level != SOL_CAN_RAW) |
426 | return -EINVAL; | 426 | return -EINVAL; |
427 | if (optlen < 0) | ||
428 | return -EINVAL; | ||
429 | 427 | ||
430 | switch (optname) { | 428 | switch (optname) { |
431 | 429 | ||
diff --git a/net/compat.c b/net/compat.c index e13f5256fd20..6a2f75fb3f45 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -390,9 +390,6 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, | |||
390 | int err; | 390 | int err; |
391 | struct socket *sock; | 391 | struct socket *sock; |
392 | 392 | ||
393 | if (optlen < 0) | ||
394 | return -EINVAL; | ||
395 | |||
396 | if ((sock = sockfd_lookup(fd, &err))!=NULL) | 393 | if ((sock = sockfd_lookup(fd, &err))!=NULL) |
397 | { | 394 | { |
398 | err = security_socket_setsockopt(sock,level,optname); | 395 | err = security_socket_setsockopt(sock,level,optname); |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index a72f43ce33be..cafad9baff03 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -480,7 +480,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
480 | case IP_OPTIONS: | 480 | case IP_OPTIONS: |
481 | { | 481 | { |
482 | struct ip_options *opt = NULL; | 482 | struct ip_options *opt = NULL; |
483 | if (optlen > 40 || optlen < 0) | 483 | if (optlen > 40) |
484 | goto e_inval; | 484 | goto e_inval; |
485 | err = ip_options_get_from_user(sock_net(sk), &opt, | 485 | err = ip_options_get_from_user(sock_net(sk), &opt, |
486 | optval, optlen); | 486 | optval, optlen); |