From: "chas williams - CONTRACTOR" <chas@cmf.nrl.navy.mil>
To: netdev@vger.kernel.org, linux-atm-general@lists.sourceforge.net
Subject: Subject: [PATCH 2/2] atm: br2684: Avoid alignment issues
Date: Mon, 28 Nov 2011 13:40:43 -0500 [thread overview]
Message-ID: <201111281840.pASIehr6011893@cmf.nrl.navy.mil> (raw)
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Wed, 17 Aug 2011 08:37:52 +0200
Subject: [PATCH 2/2] atm: br2684: Avoid alignment issues
Use memcmp() instead of cast to u16 when checking the PAD field.
Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
---
net/atm/br2684.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index ed72263..353fccf 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -53,6 +53,7 @@ static const unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
static const unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
static const unsigned char llc_oui_pid_pad[] =
{ LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };
+static const unsigned char pad[] = { PAD_BRIDGED };
static const unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 };
static const unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 };
@@ -453,7 +454,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
skb->pkt_type = PACKET_HOST;
} else { /* p_bridged */
/* first 2 chars should be 0 */
- if (*((u16 *) (skb->data)) != 0)
+ if (memcmp(skb->data, pad, BR2684_PAD_LEN) != 0)
goto error;
skb_pull(skb, BR2684_PAD_LEN);
skb->protocol = eth_type_trans(skb, net_dev);
--
1.7.6
next reply other threads:[~2011-11-28 18:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 18:40 chas williams - CONTRACTOR [this message]
2011-11-29 6:21 ` Subject: [PATCH 2/2] atm: br2684: Avoid alignment issues 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=201111281840.pASIehr6011893@cmf.nrl.navy.mil \
--to=chas@cmf.nrl.navy.mil \
--cc=linux-atm-general@lists.sourceforge.net \
--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