aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm
diff options
context:
space:
mode:
authorPascal Hambourg <pascal@plouf.fr.eu.org>2011-08-17 02:37:52 -0400
committerDavid S. Miller <davem@davemloft.net>2011-11-29 00:28:06 -0500
commitbefc93fe76177b3b6ee1e3351b58293866f43aa6 (patch)
tree628719a9883321ada7fde842141a739565c51f5b /net/atm
parent9e667b29880df842085150d60e26c60f141fff44 (diff)
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm')
-rw-r--r--net/atm/br2684.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index ed72263d0dc7..353fccf1cde3 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -53,6 +53,7 @@ static const unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
53static const unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 }; 53static const unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
54static const unsigned char llc_oui_pid_pad[] = 54static const unsigned char llc_oui_pid_pad[] =
55 { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED }; 55 { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };
56static const unsigned char pad[] = { PAD_BRIDGED };
56static const unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 }; 57static const unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 };
57static const unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 }; 58static const unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 };
58 59
@@ -453,7 +454,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
453 skb->pkt_type = PACKET_HOST; 454 skb->pkt_type = PACKET_HOST;
454 } else { /* p_bridged */ 455 } else { /* p_bridged */
455 /* first 2 chars should be 0 */ 456 /* first 2 chars should be 0 */
456 if (*((u16 *) (skb->data)) != 0) 457 if (memcmp(skb->data, pad, BR2684_PAD_LEN) != 0)
457 goto error; 458 goto error;
458 skb_pull(skb, BR2684_PAD_LEN); 459 skb_pull(skb, BR2684_PAD_LEN);
459 skb->protocol = eth_type_trans(skb, net_dev); 460 skb->protocol = eth_type_trans(skb, net_dev);