Skip to content

Commit

Permalink
Bluetooth: HCI: Fix definition of hci_rp_delete_stored_link_key
Browse files Browse the repository at this point in the history
num_keys is actually 2 octects not 1:

BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E
page 1989:

  Num_Keys_Deleted:
  Size: 2 octets
  0xXXXX	Number of Link Keys Deleted

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Luiz Augusto von Dentz authored and Marcel Holtmann committed Nov 25, 2021
1 parent e88422b commit 7978656
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/net/bluetooth/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ struct hci_cp_delete_stored_link_key {
} __packed;
struct hci_rp_delete_stored_link_key {
__u8 status;
__u8 num_keys;
__le16 num_keys;
} __packed;

#define HCI_MAX_NAME_LENGTH 248
Expand Down
2 changes: 1 addition & 1 deletion net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static void hci_cc_delete_stored_link_key(struct hci_dev *hdev,
return;

if (rp->num_keys <= hdev->stored_num_keys)
hdev->stored_num_keys -= rp->num_keys;
hdev->stored_num_keys -= le16_to_cpu(rp->num_keys);
else
hdev->stored_num_keys = 0;
}
Expand Down

0 comments on commit 7978656

Please sign in to comment.