From: Roel Kluin <roel.kluin@gmail.com>
To: Greg Kroah-Hartman <gregkh@suse.de>,
linux-usb@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] asix: fix unsetting of AX88172_MEDIUM_FD in ax88172_link_reset()
Date: Wed, 28 Oct 2009 11:58:39 +0100 [thread overview]
Message-ID: <4AE823DF.8010706@gmail.com> (raw)
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@gmail.com>
---
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);
reply other threads:[~2009-10-28 10:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AE823DF.8010706@gmail.com \
--to=roel.kluin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.