Commit 613a1c0c authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Gustavo F. Padovan

Bluetooth: Clean up magic pointers

Signed-off-by: default avatarAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 32ac5b9b
...@@ -979,9 +979,14 @@ struct hci_ev_role_change { ...@@ -979,9 +979,14 @@ struct hci_ev_role_change {
} __packed; } __packed;
#define HCI_EV_NUM_COMP_PKTS 0x13 #define HCI_EV_NUM_COMP_PKTS 0x13
struct hci_comp_pkts_info {
__le16 handle;
__le16 count;
} __packed;
struct hci_ev_num_comp_pkts { struct hci_ev_num_comp_pkts {
__u8 num_hndl; __u8 num_hndl;
/* variable length part */ struct hci_comp_pkts_info handles[0];
} __packed; } __packed;
#define HCI_EV_MODE_CHANGE 0x14 #define HCI_EV_MODE_CHANGE 0x14
......
...@@ -2256,7 +2256,6 @@ static inline void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb ...@@ -2256,7 +2256,6 @@ static inline void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb
static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb)
{ {
struct hci_ev_num_comp_pkts *ev = (void *) skb->data; struct hci_ev_num_comp_pkts *ev = (void *) skb->data;
__le16 *ptr;
int i; int i;
skb_pull(skb, sizeof(*ev)); 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,12 +2272,13 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
return; return;
} }
for (i = 0, ptr = (__le16 *) skb->data; i < ev->num_hndl; i++) { for (i = 0; i < ev->num_hndl; i++) {
struct hci_comp_pkts_info *info = &ev->handles[i];
struct hci_conn *conn; struct hci_conn *conn;
__u16 handle, count; __u16 handle, count;
handle = get_unaligned_le16(ptr++); handle = __le16_to_cpu(info->handle);
count = get_unaligned_le16(ptr++); count = __le16_to_cpu(info->count);
conn = hci_conn_hash_lookup_handle(hdev, handle); conn = hci_conn_hash_lookup_handle(hdev, handle);
if (!conn) if (!conn)
......
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