Skip to content

Commit

Permalink
net: Cleanup redundant tests on unsigned
Browse files Browse the repository at this point in the history
If there is data, the unsigned skb->len is greater than 0.

rt.sigdigits is unsigned as well, so the test `>= 0' is
always true, the other part of the test catches wrapped
values.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
roel kluin authored and David S. Miller committed Oct 29, 2009
1 parent 50e4fe9 commit 091bb8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/x25/x25_in.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp
/*
* Copy any Call User Data.
*/
if (skb->len >= 0) {
if (skb->len > 0) {
skb_copy_from_linear_data(skb,
x25->calluserdata.cuddata,
skb->len);
Expand Down
2 changes: 1 addition & 1 deletion net/x25/x25_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ int x25_route_ioctl(unsigned int cmd, void __user *arg)
goto out;

rc = -EINVAL;
if (rt.sigdigits < 0 || rt.sigdigits > 15)
if (rt.sigdigits > 15)
goto out;

dev = x25_dev_get(rt.device);
Expand Down

0 comments on commit 091bb8a

Please sign in to comment.