Skip to contentSkip to conversation

Bluetooth: hci: Represent advertising report payloads as bytes

PATCH In review Kyle Pepper 2 participants 4 messages Oct 14 – Oct 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: hci: Represent advertising report payloads as bytes

Advertising records have variable-length data and cannot form a C array of flexible structures. Describe the report payloads as bytes to avoid Sparse warnings without changing their wire layout.

Assisted-by OpenCode:gpt-6.1-sol sparse

---
Separate cleanup of warnings inherited from upstream, not a v2 of the UB500 shared-buffer RFC. The same two "array of flexible structures" warnings reproduce on that RFC's parent and exact submitted commit. The public bot report only contains the matching include-file note; its complete Sparse output was not available.

Testing:
- GCC W=1 C=2: hci_event.o and btusb_main.o, no diagnostics after cleanup.
- Exact submitted UB500 commit plus this cleanup: same clean checks.
- Strict GCC/Clang layout checks and LLVM/32-bit hci_event.o builds pass.
- GCC hci_event .text section is byte-identical before/after cleanup.
- A guest carrying the cleanup passes pairing and both HoG variants on baseline BlueZ and each of four independent ASHA topics: 15/15.

This does not change the UB500 quirk or certify an unseen complete remote Sparse report. No full architecture/configuration build matrix or physical hearing-aid regression test is claimed.

 include/net/bluetooth/hci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/bluetooth/hci.h +2 -2
index 1641d879d..e873ffc15 100644
@@ -2972,7 +2972,7 @@ struct hci_ev_le_advertising_info {
 
 struct hci_ev_le_advertising_report {
 	__u8    num;
-	struct hci_ev_le_advertising_info info[];
+	__u8    data[];
 } __packed;
 
 #define HCI_EV_LE_CONN_UPDATE_COMPLETE	0x03
@@ -3058,7 +3058,7 @@ struct hci_ev_le_ext_adv_info {
 
 struct hci_ev_le_ext_adv_report {
 	__u8     num;
-	struct hci_ev_le_ext_adv_info info[];
+	__u8     data[];
 } __packed;
 
 #define HCI_EV_LE_PA_SYNC_ESTABLISHED	0x0e

base-commit: 609a23989d637e2f90522a37c62e65c8c9b8b0ff

#1 lore raw

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/series/1185255/

---Test result---

Test Summary:

CheckPatch                    PASS      0.71 seconds
VerifyFixes                   PASS      0.24 seconds
VerifySignedoff               PASS      0.10 seconds
GitLint                       PASS      0.24 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      18.50 seconds
CheckAllWarning               PASS      21.35 seconds
CheckSparse                   PASS      23.11 seconds
BuildKernel32                 PASS      18.58 seconds
CheckKernelLLVM               PASS      20.17 seconds
TestRunnerSetup               PASS      411.44 seconds
TestRunner_l2cap-tester       PASS      12.70 seconds
TestRunner_iso-tester         PASS      8.44 seconds
TestRunner_bnep-tester        PASS      2.70 seconds
TestRunner_mgmt-tester        PASS      80.07 seconds
TestRunner_rfcomm-tester      PASS      4.25 seconds
TestRunner_sco-tester         PASS      4.81 seconds
TestRunner_ioctl-tester       PASS      3.95 seconds
TestRunner_mesh-tester        PASS      4.94 seconds
TestRunner_smp-tester         PASS      3.85 seconds
TestRunner_userchan-tester    PASS      2.75 seconds
TestRunner_6lowpan-tester     PASS      4.01 seconds
IncrementalBuild              PASS      17.14 seconds

https://github.com/bluez/bluetooth-next/pull/928

---
Regards,
Linux Bluetooth

author
#2 lore raw
In reply to Kyle Pepper

Just checking in on this patch. Is there anything else I can do to help it move forward?

Quoted 53 lines · Kyle Pepper

Advertising records have variable-length data and cannot form a C array of flexible structures. Describe the report payloads as bytes to avoid Sparse warnings without changing their wire layout.

Assisted-by OpenCode:gpt-6.1-sol sparse

---
Separate cleanup of warnings inherited from upstream, not a v2 of the UB500 shared-buffer RFC. The same two "array of flexible structures" warnings reproduce on that RFC's parent and exact submitted commit. The public bot report only contains the matching include-file note; its complete Sparse output was not available.

Testing:
- GCC W=1 C=2: hci_event.o and btusb_main.o, no diagnostics after cleanup.
- Exact submitted UB500 commit plus this cleanup: same clean checks.
- Strict GCC/Clang layout checks and LLVM/32-bit hci_event.o builds pass.
- GCC hci_event .text section is byte-identical before/after cleanup.
- A guest carrying the cleanup passes pairing and both HoG variants on baseline BlueZ and each of four independent ASHA topics: 15/15.

This does not change the UB500 quirk or certify an unseen complete remote Sparse report. No full architecture/configuration build matrix or physical hearing-aid regression test is claimed.

 include/net/bluetooth/hci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/bluetooth/hci.h +2 -2
index 1641d879d..e873ffc15 100644
@@ -2972,7 +2972,7 @@ struct hci_ev_le_advertising_info {
 
 struct hci_ev_le_advertising_report {
 	__u8    num;
-	struct hci_ev_le_advertising_info info[];
+	__u8    data[];
 } __packed;
 
 #define HCI_EV_LE_CONN_UPDATE_COMPLETE	0x03
@@ -3058,7 +3058,7 @@ struct hci_ev_le_ext_adv_info {
 
 struct hci_ev_le_ext_adv_report {
 	__u8     num;
-	struct hci_ev_le_ext_adv_info info[];
+	__u8     data[];
 } __packed;
 
 #define HCI_EV_LE_PA_SYNC_ESTABLISHED	0x0e

base-commit: 609a23989d637e2f90522a37c62e65c8c9b8b0ff

author
#3 lore raw

I'm withdrawing this patch since v3 of the UB500 patch at https://lore.kernel.org/linux-bluetooth/[email protected]/ is no longer producing any warnings.

Quoted 59 lines · cochcoder

Just checking in on this patch. Is there anything else I can do to help it move forward?

Quoted 53 lines · Kyle Pepper

Advertising records have variable-length data and cannot form a C array of flexible structures. Describe the report payloads as bytes to avoid Sparse warnings without changing their wire layout.

Assisted-by OpenCode:gpt-6.1-sol sparse

---
Separate cleanup of warnings inherited from upstream, not a v2 of the UB500 shared-buffer RFC. The same two "array of flexible structures" warnings reproduce on that RFC's parent and exact submitted commit. The public bot report only contains the matching include-file note; its complete Sparse output was not available.

Testing:
- GCC W=1 C=2: hci_event.o and btusb_main.o, no diagnostics after cleanup.
- Exact submitted UB500 commit plus this cleanup: same clean checks.
- Strict GCC/Clang layout checks and LLVM/32-bit hci_event.o builds pass.
- GCC hci_event .text section is byte-identical before/after cleanup.
- A guest carrying the cleanup passes pairing and both HoG variants on baseline BlueZ and each of four independent ASHA topics: 15/15.

This does not change the UB500 quirk or certify an unseen complete remote Sparse report. No full architecture/configuration build matrix or physical hearing-aid regression test is claimed.

 include/net/bluetooth/hci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/bluetooth/hci.h +2 -2
index 1641d879d..e873ffc15 100644
@@ -2972,7 +2972,7 @@ struct hci_ev_le_advertising_info {
 
 struct hci_ev_le_advertising_report {
 	__u8    num;
-	struct hci_ev_le_advertising_info info[];
+	__u8    data[];
 } __packed;
 
 #define HCI_EV_LE_CONN_UPDATE_COMPLETE	0x03
@@ -3058,7 +3058,7 @@ struct hci_ev_le_ext_adv_info {
 
 struct hci_ev_le_ext_adv_report {
 	__u8     num;
-	struct hci_ev_le_ext_adv_info info[];
+	__u8     data[];
 } __packed;
 
 #define HCI_EV_LE_PA_SYNC_ESTABLISHED	0x0e

base-commit: 609a23989d637e2f90522a37c62e65c8c9b8b0ff