aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2011-12-19 09:31:30 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-12-20 14:00:22 -0500
commit613a1c0c595fe2f2d9148a705f140a53bc9f56e1 (patch)
tree3757193937538e1eb162039c205ae25dc2664d2b
parent32ac5b9b57ef521470f930fd00849be4705bc134 (diff)
Bluetooth: Clean up magic pointers
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r--include/net/bluetooth/hci.h7
-rw-r--r--net/bluetooth/hci_event.c8
2 files changed, 10 insertions, 5 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 66b26399a1ca..6127ca8bd1d1 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -979,9 +979,14 @@ struct hci_ev_role_change {
979} __packed; 979} __packed;
980 980
981#define HCI_EV_NUM_COMP_PKTS 0x13 981#define HCI_EV_NUM_COMP_PKTS 0x13
982struct hci_comp_pkts_info {
983 __le16 handle;
984 __le16 count;
985} __packed;
986
982struct hci_ev_num_comp_pkts { 987struct hci_ev_num_comp_pkts {
983 __u8 num_hndl; 988 __u8 num_hndl;
984 /* variable length part */ 989 struct hci_comp_pkts_info handles[0];
985} __packed; 990} __packed;
986 991
987#define HCI_EV_MODE_CHANGE 0x14 992#define HCI_EV_MODE_CHANGE 0x14
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 5a204aefc035..b9d77be92d3b 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2256,7 +2256,6 @@ static inline void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb
2256static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) 2256static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb)
2257{ 2257{
2258 struct hci_ev_num_comp_pkts *ev = (void *) skb->data; 2258 struct hci_ev_num_comp_pkts *ev = (void *) skb->data;
2259 __le16 *ptr;
2260 int i; 2259 int i;
2261 2260
2262 skb_pull(skb, sizeof(*ev)); 2261 skb_pull(skb, sizeof(*ev));
@@ -2273,12 +2272,13 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
2273 return; 2272 return;
2274 } 2273 }
2275 2274
2276 for (i = 0, ptr = (__le16 *) skb->data; i < ev->num_hndl; i++) { 2275 for (i = 0; i < ev->num_hndl; i++) {
2276 struct hci_comp_pkts_info *info = &ev->handles[i];
2277 struct hci_conn *conn; 2277 struct hci_conn *conn;
2278 __u16 handle, count; 2278 __u16 handle, count;
2279 2279
2280 handle = get_unaligned_le16(ptr++); 2280 handle = __le16_to_cpu(info->handle);
2281 count = get_unaligned_le16(ptr++); 2281 count = __le16_to_cpu(info->count);
2282 2282
2283 conn = hci_conn_hash_lookup_handle(hdev, handle); 2283 conn = hci_conn_hash_lookup_handle(hdev, handle);
2284 if (!conn) 2284 if (!conn)