Skip to content

Commit 83b4b19

Browse files
yekai123123holtmann
authored andcommitted
Bluetooth: smp: Use the correct print format
According to Documentation/core-api/printk-formats.rst, Use the correct print format. Printing an unsigned int value should use %u instead of %d. Otherwise printk() might end up displaying negative numbers. Signed-off-by: Kai Ye <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 79dbeaf commit 83b4b19

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/bluetooth/smp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
859859
memset(smp->tk, 0, sizeof(smp->tk));
860860
clear_bit(SMP_FLAG_TK_VALID, &smp->flags);
861861

862-
bt_dev_dbg(hcon->hdev, "auth:%d lcl:%d rem:%d", auth, local_io,
862+
bt_dev_dbg(hcon->hdev, "auth:%u lcl:%u rem:%u", auth, local_io,
863863
remote_io);
864864

865865
/* If neither side wants MITM, either "just" confirm an incoming
@@ -925,7 +925,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
925925
get_random_bytes(&passkey, sizeof(passkey));
926926
passkey %= 1000000;
927927
put_unaligned_le32(passkey, smp->tk);
928-
bt_dev_dbg(hcon->hdev, "PassKey: %d", passkey);
928+
bt_dev_dbg(hcon->hdev, "PassKey: %u", passkey);
929929
set_bit(SMP_FLAG_TK_VALID, &smp->flags);
930930
}
931931

@@ -1655,7 +1655,7 @@ int smp_user_confirm_reply(struct hci_conn *hcon, u16 mgmt_op, __le32 passkey)
16551655
case MGMT_OP_USER_PASSKEY_REPLY:
16561656
value = le32_to_cpu(passkey);
16571657
memset(smp->tk, 0, sizeof(smp->tk));
1658-
bt_dev_dbg(conn->hcon->hdev, "PassKey: %d", value);
1658+
bt_dev_dbg(conn->hcon->hdev, "PassKey: %u", value);
16591659
put_unaligned_le32(value, smp->tk);
16601660
fallthrough;
16611661
case MGMT_OP_USER_CONFIRM_REPLY:

0 commit comments

Comments
 (0)