From patchwork Mon Nov 28 18:40:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chas williams - CONTRACTOR X-Patchwork-Id: 128056 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 87EF5B6F75 for ; Tue, 29 Nov 2011 05:41:50 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753956Ab1K1Slp (ORCPT ); Mon, 28 Nov 2011 13:41:45 -0500 Received: from hedwig.cmf.nrl.navy.mil ([134.207.12.162]:36903 "EHLO hedwig.cmf.nrl.navy.mil" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753410Ab1K1Slo (ORCPT ); Mon, 28 Nov 2011 13:41:44 -0500 Received: from thirdoffive.cmf.nrl.navy.mil (thirdoffive.cmf.nrl.navy.mil [134.207.12.180]) by hedwig.cmf.nrl.navy.mil (8.14.2/8.14.2) with ESMTP id pASIehNF020230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 28 Nov 2011 13:40:44 -0500 Received: from cmf.nrl.navy.mil (localhost [127.0.0.1]) by thirdoffive.cmf.nrl.navy.mil (8.14.4/8.14.4) with ESMTP id pASIehZl011894; Mon, 28 Nov 2011 13:40:43 -0500 Received: from thirdoffive.cmf.nrl.navy.mil (chas@localhost) by cmf.nrl.navy.mil (8.14.4/8.14.4/Submit) with ESMTP id pASIehr6011893; Mon, 28 Nov 2011 13:40:43 -0500 Message-Id: <201111281840.pASIehr6011893@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 From: "chas williams - CONTRACTOR" X-NRLCMF-Spam-Score: () hits=-1.011 X-NRLCMF-Virus-Scanned: No virus found X-Scanned-By: MIMEDefang 2.68 on 134.207.12.162 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Pascal Hambourg 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 Signed-off-by: chas williams - CONTRACTOR --- 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);