usbnet: remove invalid check
authorAndrzej Hajda <a.hajda@samsung.com>
Mon, 21 Sep 2015 13:33:59 +0000 (15:33 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 22 Sep 2015 23:14:32 +0000 (16:14 -0700)
skb->len is always non-negative.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/lan78xx.c
drivers/net/usb/smsc75xx.c
drivers/net/usb/smsc95xx.c

index 6a70a72b565d88e481b41a9c5c28d5a94f89473a..d2a5f3f88b132991cbd4d26afe9abed3765209ea 100644 (file)
@@ -2424,11 +2424,6 @@ static int lan78xx_rx(struct lan78xx_net *dev, struct sk_buff *skb)
                        skb_pull(skb, align_count);
        }
 
-       if (unlikely(skb->len < 0)) {
-               netdev_warn(dev->net, "invalid rx length<0 %d", skb->len);
-               return 0;
-       }
-
        return 1;
 }
 
index d9e7892262faa6a0543807d4d411163a5f59ac78..30033dbe666263f12ed05cbe7d2fe1e924b156e4 100644 (file)
@@ -2185,11 +2185,6 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
                        skb_pull(skb, align_count);
        }
 
-       if (unlikely(skb->len < 0)) {
-               netdev_warn(dev->net, "invalid rx length<0 %d\n", skb->len);
-               return 0;
-       }
-
        return 1;
 }
 
index 26423adc35ee892c6a520cc243f8e71680a71eaf..66b3ab9f614eb07edb05757ee333e998f7841f7d 100644 (file)
@@ -1815,11 +1815,6 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
                        skb_pull(skb, align_count);
        }
 
-       if (unlikely(skb->len < 0)) {
-               netdev_warn(dev->net, "invalid rx length<0 %d\n", skb->len);
-               return 0;
-       }
-
        return 1;
 }