2023-09-15 21:45:19

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH] Bluetooth: hci_core: Fix build warnings

From: Luiz Augusto von Dentz <[email protected]>

This fixes the following warnings:

net/bluetooth/hci_core.c: In function ‘hci_register_dev’:
net/bluetooth/hci_core.c:2620:54: warning: ‘%d’ directive output may
be truncated writing between 1 and 10 bytes into a region of size 5
[-Wformat-truncation=]
2620 | snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
| ^~
net/bluetooth/hci_core.c:2620:50: note: directive argument in the range
[0, 2147483647]
2620 | snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
| ^~~~~~~
net/bluetooth/hci_core.c:2620:9: note: ‘snprintf’ output between 5 and
14 bytes into a destination of size 8
2620 | snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Luiz Augusto von Dentz <[email protected]>
---
net/bluetooth/hci_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index db4f28d68d71..f4a218e1a52e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2617,7 +2617,7 @@ int hci_register_dev(struct hci_dev *hdev)
if (id < 0)
return id;

- snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
+ snprintf(hdev->name, sizeof(hdev->name), "hci%.4u", id % HCI_MAX_ID);
hdev->id = id;

BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
--
2.41.0


2023-09-17 10:46:57

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: hci_core: Fix build warnings

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=784843

---Test result---

Test Summary:
CheckPatch PASS 0.64 seconds
GitLint PASS 0.30 seconds
SubjectPrefix PASS 0.10 seconds
BuildKernel PASS 34.59 seconds
CheckAllWarning PASS 37.42 seconds
CheckSparse PASS 43.00 seconds
CheckSmatch PASS 115.38 seconds
BuildKernel32 PASS 33.58 seconds
TestRunnerSetup PASS 509.12 seconds
TestRunner_l2cap-tester PASS 31.24 seconds
TestRunner_iso-tester FAIL 55.28 seconds
TestRunner_bnep-tester PASS 10.81 seconds
TestRunner_mgmt-tester FAIL 234.75 seconds
TestRunner_rfcomm-tester PASS 16.39 seconds
TestRunner_sco-tester PASS 19.65 seconds
TestRunner_ioctl-tester PASS 18.85 seconds
TestRunner_mesh-tester PASS 13.54 seconds
TestRunner_smp-tester PASS 14.42 seconds
TestRunner_userchan-tester PASS 11.17 seconds
IncrementalBuild PASS 32.28 seconds

Details
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 97, Passed: 93 (95.9%), Failed: 4, Not Run: 0

Failed Test Cases
ISO Connect Suspend - Success Failed 0.408 seconds
ISO Connected Suspend - Success Timed out 2.435 seconds
ISO Connect2 Suspend - Success Failed 0.515 seconds
ISO Connected2 Suspend - Success Timed out 2.723 seconds
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 497, Passed: 483 (97.2%), Failed: 11, Not Run: 3

Failed Test Cases
Set Static Address - Success 2 Timed out 2.391 seconds
Suspend - Success 1 Failed 0.264 seconds
Resume - Success 2 Failed 0.279 seconds
Suspend - Success 3 (Device in WL) Failed 0.293 seconds
Suspend - Success 4 (Advertising) Failed 0.292 seconds
Suspend - Success 5 (Pairing - Legacy) Timed out 1.858 seconds
Suspend - Success 6 (Pairing - SSP) Timed out 1.993 seconds
Suspend - Success 7 (Suspend/Force Wakeup) Failed 0.271 seconds
Suspend - Success 8 (Discovery/Suspend) Timed out 4.683 seconds
Resume - Success 9 (Discovery/Suspend/Resume) Timed out 3.990 seconds
Resume - Success 10 (Multiple Suspend/Resume) Timed out 5.987 seconds


---
Regards,
Linux Bluetooth