Commit 65a1c4ff authored by roel kluin's avatar roel kluin Committed by David S. Miller

net: Cleanup redundant tests on unsigned

optlen is unsigned so the `< 0' test is never true.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 091bb8ab
...@@ -424,8 +424,6 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, ...@@ -424,8 +424,6 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
if (level != SOL_CAN_RAW) if (level != SOL_CAN_RAW)
return -EINVAL; return -EINVAL;
if (optlen < 0)
return -EINVAL;
switch (optname) { switch (optname) {
......
...@@ -390,9 +390,6 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, ...@@ -390,9 +390,6 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
int err; int err;
struct socket *sock; struct socket *sock;
if (optlen < 0)
return -EINVAL;
if ((sock = sockfd_lookup(fd, &err))!=NULL) if ((sock = sockfd_lookup(fd, &err))!=NULL)
{ {
err = security_socket_setsockopt(sock,level,optname); err = security_socket_setsockopt(sock,level,optname);
......
...@@ -480,7 +480,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -480,7 +480,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
case IP_OPTIONS: case IP_OPTIONS:
{ {
struct ip_options *opt = NULL; struct ip_options *opt = NULL;
if (optlen > 40 || optlen < 0) if (optlen > 40)
goto e_inval; goto e_inval;
err = ip_options_get_from_user(sock_net(sk), &opt, err = ip_options_get_from_user(sock_net(sk), &opt,
optval, optlen); optval, optlen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment