From: Pascal H. <pa...@pl...> - 2011-08-17 06:38:00
|
Use memcmp() instead of cast to u16 when checking the PAD field. Signed-off-by: Pascal Hambourg <pa...@pl...> --- net/atm/br2684.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff -uprN a/net/atm/br2684.c b/net/atm/br2684.c --- a/net/atm/br2684.c 2011-08-16 22:13:47.000000000 +0200 +++ b/net/atm/br2684.c 2011-08-16 22:13:49.000000000 +0200 @@ -53,6 +53,7 @@ static const unsigned char ethertype_ipv 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 }; @@ -434,7 +435,7 @@ static void br2684_push(struct atm_vcc * */ if ((skb->len >= sizeof(llc_oui_pid_pad) + ETH_HLEN) && (memcmp(skb->data, llc_oui_pid_pad, 7) == 0) && - (*((u16 *) (skb->data + 8)) == 0)) { + (memcmp(skb->data + 8, pad, BR2684_PAD_LEN) == 0)) { if (skb->data[7] == 0x01 && skb->len >= sizeof(llc_oui_pid_pad) + ETH_ZLEN + ETH_FCS_LEN) __skb_trim(skb, skb->len - ETH_FCS_LEN); /* trim FCS */ @@ -464,7 +465,7 @@ static void br2684_push(struct atm_vcc * } else { /* p_bridged */ /* first 2 chars should be 0 */ if (skb->len < BR2684_PAD_LEN + ETH_HLEN || - *((u16 *) (skb->data)) != 0) + memcmp(skb->data, pad, BR2684_PAD_LEN) != 0) goto error; skb_pull(skb, BR2684_PAD_LEN); skb->protocol = eth_type_trans(skb, net_dev); |