diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-03-12 23:31:08 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo@padovan.org> | 2012-05-08 23:41:32 -0400 |
commit | 1f350c8724881fe6b1be9aa68d1e49508a6f8ab9 (patch) | |
tree | 20d6af5d3e05bcb8c3a15d57010cdf5093c638ff /net/bluetooth/mgmt.c | |
parent | 1036b89042df96e71c0cb941be212f8053ecccc0 (diff) |
Bluetooth: Fix broken usage of get_unaligned_le16
In case the struct is already __packed, there is no need to use unaligned
access to the data. So just use __le16_to_cpu in these cases.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r-- | net/bluetooth/mgmt.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 194a0426a3e5..287623c35d61 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -862,7 +862,7 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data, | |||
862 | 862 | ||
863 | BT_DBG("request for %s", hdev->name); | 863 | BT_DBG("request for %s", hdev->name); |
864 | 864 | ||
865 | timeout = get_unaligned_le16(&cp->timeout); | 865 | timeout = __le16_to_cpu(cp->timeout); |
866 | if (!cp->val && timeout > 0) | 866 | if (!cp->val && timeout > 0) |
867 | return cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, | 867 | return cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, |
868 | MGMT_STATUS_INVALID_PARAMS); | 868 | MGMT_STATUS_INVALID_PARAMS); |
@@ -1461,7 +1461,7 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data, | |||
1461 | u16 key_count, expected_len; | 1461 | u16 key_count, expected_len; |
1462 | int i; | 1462 | int i; |
1463 | 1463 | ||
1464 | key_count = get_unaligned_le16(&cp->key_count); | 1464 | key_count = __le16_to_cpu(cp->key_count); |
1465 | 1465 | ||
1466 | expected_len = sizeof(*cp) + key_count * | 1466 | expected_len = sizeof(*cp) + key_count * |
1467 | sizeof(struct mgmt_link_key_info); | 1467 | sizeof(struct mgmt_link_key_info); |
@@ -2611,7 +2611,7 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev, | |||
2611 | u16 key_count, expected_len; | 2611 | u16 key_count, expected_len; |
2612 | int i; | 2612 | int i; |
2613 | 2613 | ||
2614 | key_count = get_unaligned_le16(&cp->key_count); | 2614 | key_count = __le16_to_cpu(cp->key_count); |
2615 | 2615 | ||
2616 | expected_len = sizeof(*cp) + key_count * | 2616 | expected_len = sizeof(*cp) + key_count * |
2617 | sizeof(struct mgmt_ltk_info); | 2617 | sizeof(struct mgmt_ltk_info); |
@@ -2722,9 +2722,9 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen) | |||
2722 | } | 2722 | } |
2723 | 2723 | ||
2724 | hdr = buf; | 2724 | hdr = buf; |
2725 | opcode = get_unaligned_le16(&hdr->opcode); | 2725 | opcode = __le16_to_cpu(hdr->opcode); |
2726 | index = get_unaligned_le16(&hdr->index); | 2726 | index = __le16_to_cpu(hdr->index); |
2727 | len = get_unaligned_le16(&hdr->len); | 2727 | len = __le16_to_cpu(hdr->len); |
2728 | 2728 | ||
2729 | if (len != msglen - sizeof(*hdr)) { | 2729 | if (len != msglen - sizeof(*hdr)) { |
2730 | err = -EINVAL; | 2730 | err = -EINVAL; |