aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-03-20 02:18:14 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-03-20 02:22:07 -0400
commit39adbffe4b16285c54016d3e64471396354ae49f (patch)
tree81196bfad50006fea2eec9c9175705fdd267f6d3 /net
parent40b552aa5a0bfa785bc7ddb5c2d7965b1e0bb08d (diff)
Bluetooth: Fix passkey endianess in user_confirm and notify_passkey
The passkey_notify and user_confirm functions in mgmt.c were expecting different endianess for the passkey, leading to a big endian bug and sparse warning in recently added SMP code. This patch converts both functions to expect host endianess and do the conversion to little endian only when assigning to the mgmt event struct. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_event.c4
-rw-r--r--net/bluetooth/mgmt.c4
-rw-r--r--net/bluetooth/smp.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a6a3d32553c5..1e386edc338f 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3459,8 +3459,8 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev,
3459 } 3459 }
3460 3460
3461confirm: 3461confirm:
3462 mgmt_user_confirm_request(hdev, &ev->bdaddr, ACL_LINK, 0, ev->passkey, 3462 mgmt_user_confirm_request(hdev, &ev->bdaddr, ACL_LINK, 0,
3463 confirm_hint); 3463 le32_to_cpu(ev->passkey), confirm_hint);
3464 3464
3465unlock: 3465unlock:
3466 hci_dev_unlock(hdev); 3466 hci_dev_unlock(hdev);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 96670f581bb0..739887c6b286 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5338,7 +5338,7 @@ void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
5338} 5338}
5339 5339
5340int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 5340int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
5341 u8 link_type, u8 addr_type, __le32 value, 5341 u8 link_type, u8 addr_type, u32 value,
5342 u8 confirm_hint) 5342 u8 confirm_hint)
5343{ 5343{
5344 struct mgmt_ev_user_confirm_request ev; 5344 struct mgmt_ev_user_confirm_request ev;
@@ -5348,7 +5348,7 @@ int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
5348 bacpy(&ev.addr.bdaddr, bdaddr); 5348 bacpy(&ev.addr.bdaddr, bdaddr);
5349 ev.addr.type = link_to_bdaddr(link_type, addr_type); 5349 ev.addr.type = link_to_bdaddr(link_type, addr_type);
5350 ev.confirm_hint = confirm_hint; 5350 ev.confirm_hint = confirm_hint;
5351 ev.value = value; 5351 ev.value = cpu_to_le32(value);
5352 5352
5353 return mgmt_event(MGMT_EV_USER_CONFIRM_REQUEST, hdev, &ev, sizeof(ev), 5353 return mgmt_event(MGMT_EV_USER_CONFIRM_REQUEST, hdev, &ev, sizeof(ev),
5354 NULL); 5354 NULL);
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 2a7ee7f6cd8b..13919ff82e05 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -425,7 +425,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
425 else 425 else
426 ret = mgmt_user_passkey_notify(hcon->hdev, &hcon->dst, 426 ret = mgmt_user_passkey_notify(hcon->hdev, &hcon->dst,
427 hcon->type, hcon->dst_type, 427 hcon->type, hcon->dst_type,
428 cpu_to_le32(passkey), 0); 428 passkey, 0);
429 429
430 hci_dev_unlock(hcon->hdev); 430 hci_dev_unlock(hcon->hdev);
431 431