[PATCH] asix: fix unsetting of AX88172_MEDIUM_FD in ax88172_link_reset()

From: Roel Kluin
Date: Wed Oct 28 2009 - 06:48:05 EST


struct skb->len is unsigned so the `< 0' test always fails.
Besides, skb_pull ensures that skb->len does not wrap. Also
correctly unset the AX88172_MEDIUM_FD bit.

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
---
drivers/net/usb/asix.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)

// vi drivers/net/usb/asix.c +77
#define AX88172_MEDIUM_FD 0x02

// vi drivers/net/usb/asix.c +80
#define AX88172_MEDIUM_DEFAULT \
( AX88172_MEDIUM_FD | AX88172_MEDIUM_TX | AX88172_MEDIUM_FC )

diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 6ce7f77..26a9d46 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -346,11 +346,6 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
packet = head + sizeof(header);
skb_pull(skb, 4);
}
-
- if (skb->len < 0) {
- deverr(dev,"asix_rx_fixup() Bad SKB Length %d", skb->len);
- return 0;
- }
return 1;
}

@@ -798,7 +793,7 @@ static int ax88172_link_reset(struct usbnet *dev)
mode = AX88172_MEDIUM_DEFAULT;

if (ecmd.duplex != DUPLEX_FULL)
- mode |= ~AX88172_MEDIUM_FD;
+ mode &= ~AX88172_MEDIUM_FD;

devdbg(dev, "ax88172_link_reset() speed: %d duplex: %d setting mode to 0x%04x", ecmd.speed, ecmd.duplex, mode);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/