Commit 1bc5d448 authored by Al Viro's avatar Al Viro Committed by David S. Miller

[BLUETOOTH]: bnep endianness annotations

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e41d2169
...@@ -95,14 +95,14 @@ struct bnep_setup_conn_req { ...@@ -95,14 +95,14 @@ struct bnep_setup_conn_req {
struct bnep_set_filter_req { struct bnep_set_filter_req {
__u8 type; __u8 type;
__u8 ctrl; __u8 ctrl;
__u16 len; __be16 len;
__u8 list[0]; __u8 list[0];
} __attribute__((packed)); } __attribute__((packed));
struct bnep_control_rsp { struct bnep_control_rsp {
__u8 type; __u8 type;
__u8 ctrl; __u8 ctrl;
__u16 resp; __be16 resp;
} __attribute__((packed)); } __attribute__((packed));
struct bnep_ext_hdr { struct bnep_ext_hdr {
......
...@@ -128,7 +128,7 @@ static inline void bnep_set_default_proto_filter(struct bnep_session *s) ...@@ -128,7 +128,7 @@ static inline void bnep_set_default_proto_filter(struct bnep_session *s)
} }
#endif #endif
static int bnep_ctrl_set_netfilter(struct bnep_session *s, u16 *data, int len) static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len)
{ {
int n; int n;
...@@ -180,7 +180,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len) ...@@ -180,7 +180,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
if (len < 2) if (len < 2)
return -EILSEQ; return -EILSEQ;
n = ntohs(get_unaligned((u16 *) data)); n = ntohs(get_unaligned((__be16 *) data));
data += 2; len -= 2; data += 2; len -= 2;
if (len < n) if (len < n)
...@@ -332,7 +332,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) ...@@ -332,7 +332,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
if (!skb_pull(skb, __bnep_rx_hlen[type & BNEP_TYPE_MASK])) if (!skb_pull(skb, __bnep_rx_hlen[type & BNEP_TYPE_MASK]))
goto badframe; goto badframe;
s->eh.h_proto = get_unaligned((u16 *) (skb->data - 2)); s->eh.h_proto = get_unaligned((__be16 *) (skb->data - 2));
if (type & BNEP_EXT_HEADER) { if (type & BNEP_EXT_HEADER) {
if (bnep_rx_extension(s, skb) < 0) if (bnep_rx_extension(s, skb) < 0)
...@@ -343,7 +343,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) ...@@ -343,7 +343,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
if (ntohs(s->eh.h_proto) == 0x8100) { if (ntohs(s->eh.h_proto) == 0x8100) {
if (!skb_pull(skb, 4)) if (!skb_pull(skb, 4))
goto badframe; goto badframe;
s->eh.h_proto = get_unaligned((u16 *) (skb->data - 2)); s->eh.h_proto = get_unaligned((__be16 *) (skb->data - 2));
} }
/* We have to alloc new skb and copy data here :(. Because original skb /* We have to alloc new skb and copy data here :(. Because original skb
...@@ -365,7 +365,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) ...@@ -365,7 +365,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
case BNEP_COMPRESSED_SRC_ONLY: case BNEP_COMPRESSED_SRC_ONLY:
memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN); memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN);
memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN); memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN);
put_unaligned(s->eh.h_proto, (u16 *) __skb_put(nskb, 2)); put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2));
break; break;
case BNEP_COMPRESSED_DST_ONLY: case BNEP_COMPRESSED_DST_ONLY:
...@@ -375,7 +375,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) ...@@ -375,7 +375,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
case BNEP_GENERAL: case BNEP_GENERAL:
memcpy(__skb_put(nskb, ETH_ALEN * 2), skb->mac.raw, ETH_ALEN * 2); memcpy(__skb_put(nskb, ETH_ALEN * 2), skb->mac.raw, ETH_ALEN * 2);
put_unaligned(s->eh.h_proto, (u16 *) __skb_put(nskb, 2)); put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2));
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment