Skip to content

Commit

Permalink
net: Cleanup redundant tests on unsigned
Browse files Browse the repository at this point in the history
optlen is unsigned so the `< 0' test is never true.

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
RoelKluin authored and davem330 committed Oct 29, 2009
1 parent 091bb8a commit 65a1c4f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
2 changes: 0 additions & 2 deletions net/can/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
3 changes: 0 additions & 3 deletions net/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/ip_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 65a1c4f

Please sign in to comment.