netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	gregkh@suse.de, Marek Vasut <marek.vasut@gmail.com>
Subject: [PATCH 2/2] ASIX: Use only 11 bits of header for data size
Date: Wed, 27 Jul 2011 04:44:47 +0200	[thread overview]
Message-ID: <1311734687-23551-2-git-send-email-marek.vasut@gmail.com> (raw)
In-Reply-To: <1311734687-23551-1-git-send-email-marek.vasut@gmail.com>

The AX88772B uses only 11 bits of the header for the actual size. The other bits
are used for something else. This causes dmesg full of messages:

	asix_rx_fixup() Bad Header Length

This patch trims the check to only 11 bits. I believe on older chips, the
remaining 5 top bits are unused.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
 drivers/net/usb/asix.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

NOTE: If possible, can someone test/verify this patch with other ASIX chips ?
NOTE2: If Ack-ed, Greg, can you get this into -stable?

diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index d5b62a4..c5c4b4d 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -314,11 +314,11 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 	skb_pull(skb, 4);
 
 	while (skb->len > 0) {
-		if ((header & 0xffff) != ((~header >> 16) & 0xffff))
+		if ((header & 0x07ff) != ((~header >> 16) & 0x07ff))
 			netdev_err(dev->net, "asix_rx_fixup() Bad Header Length\n");
 
 		/* get the packet length */
-		size = (u16) (header & 0x0000ffff);
+		size = (u16) (header & 0x000007ff);
 
 		if ((skb->len) - ((size + 1) & 0xfffe) == 0) {
 			u8 alignment = (unsigned long)skb->data & 0x3;
-- 
1.7.5.3

  reply	other threads:[~2011-07-27  2:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27  2:44 [PATCH 1/2] ASIX: Simplify condition in rx_fixup() Marek Vasut
2011-07-27  2:44 ` Marek Vasut [this message]
2011-07-28  5:40   ` [PATCH 2/2] ASIX: Use only 11 bits of header for data size David Miller
     [not found]     ` <20110727.224029.619127041796367339.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2011-07-28  6:06       ` Marek Vasut
2011-07-28 15:18         ` Greg KH
     [not found]           ` <20110728151806.GB22202-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2011-07-28 16:17             ` Marek Vasut
2011-07-28  5:40 ` [PATCH 1/2] ASIX: Simplify condition in rx_fixup() David Miller

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=1311734687-23551-2-git-send-email-marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).