net: Cleanup redundant tests on unsigned
authorroel kluin <roel.kluin@gmail.com>
Fri, 23 Oct 2009 05:59:21 +0000 (05:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Oct 2009 08:39:54 +0000 (01:39 -0700)
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>
net/can/raw.c
net/compat.c
net/ipv4/ip_sockglue.c

index 962fc9f1d0c7003deb909733c28f799f8fbdd38c..6e77db58b9e667d073cf45bd964200afa119bd31 100644 (file)
@@ -424,8 +424,6 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
 
        if (level != SOL_CAN_RAW)
                return -EINVAL;
-       if (optlen < 0)
-               return -EINVAL;
 
        switch (optname) {
 
index e13f5256fd20011b6e28d8549397f5137fc925b5..6a2f75fb3f45ac102b33e08907dd7059cf78a371 100644 (file)
@@ -390,9 +390,6 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
        int err;
        struct socket *sock;
 
-       if (optlen < 0)
-               return -EINVAL;
-
        if ((sock = sockfd_lookup(fd, &err))!=NULL)
        {
                err = security_socket_setsockopt(sock,level,optname);
index a72f43ce33bee17aa39b4208b6f378ef30e031e5..cafad9baff039b8c164e2da282a754c6822294a8 100644 (file)
@@ -480,7 +480,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
        case IP_OPTIONS:
        {
                struct ip_options *opt = NULL;
-               if (optlen > 40 || optlen < 0)
+               if (optlen > 40)
                        goto e_inval;
                err = ip_options_get_from_user(sock_net(sk), &opt,
                                               optval, optlen);