net: Cleanup redundant tests on unsigned
authorroel kluin <roel.kluin@gmail.com>
Fri, 23 Oct 2009 05:21:56 +0000 (05:21 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Oct 2009 08:39:53 +0000 (01:39 -0700)
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>
net/x25/x25_in.c
net/x25/x25_route.c

index 7d7c3abf38b573fa64f1bb35026dc5bf80cdcd3c..96d9227835479474e6cedaeef6704f619c1683e8 100644 (file)
@@ -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);
index 2c999ccf504a82741961e6a2420ccb07fef13b03..66961ea28c91e093785cd3a85754a27661225d9e 100644 (file)
@@ -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);