aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2026-01-27 18:40:38 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2026-01-27 18:40:38 +0000
commit72a6991b80c6e6c47a3b84337f62f0a02bd30391 (patch)
tree92ef66b2b7f814cf2ce7347b88c59a5dfe9894a5
parent5c504c625d1faffd7cc7c3dfece62c72c012b4c5 (diff)
bluetooth: Don't use a non-string to initialize NG_HCI_BDADDR_ANY
Explicitly use an array of 6 zeroes instead of a C string containing nul characters. GCC 15 warns about the truncation, but this is cleaner regardless. In file included from /usr/obj/.../amd64.amd64/tmp/usr/include/bluetooth.h:51, from usr.sbin/virtual_oss/virtual_bt_speaker/bt_speaker.c:45: usr.sbin/virtual_oss/virtual_bt_speaker/bt_speaker.c: In function 'register_sdp': usr.sbin/virtual_oss/virtual_bt_speaker/bt_speaker.c:96:13: error: initializer-string for array of 'unsigned char' truncates NUL terminator but destination lacks 'nonstring' attribute (7 chars into 6 available) [-Werror=unterminated-string-initialization] 96 | NG_HCI_BDADDR_ANY, (const uint8_t *)&record, sizeof(record), | ^~~~~~~~~~~~~~~~~ Reviewed by: dim Differential Revision: https://reviews.freebsd.org/D54869
-rw-r--r--sys/netgraph/bluetooth/include/ng_hci.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netgraph/bluetooth/include/ng_hci.h b/sys/netgraph/bluetooth/include/ng_hci.h
index 54980e128bba..bbe9541c25c9 100644
--- a/sys/netgraph/bluetooth/include/ng_hci.h
+++ b/sys/netgraph/bluetooth/include/ng_hci.h
@@ -447,8 +447,8 @@ typedef struct {
} __attribute__ ((packed)) bdaddr_t;
typedef bdaddr_t * bdaddr_p;
-/* Any BD_ADDR. Note: This is actually 7 bytes (count '\0' terminator) */
-#define NG_HCI_BDADDR_ANY (&(const bdaddr_t){"\000\000\000\000\000\000"})
+/* Any BD_ADDR. */
+#define NG_HCI_BDADDR_ANY (&(const bdaddr_t){ { 0, 0, 0, 0, 0, 0 } })
/* HCI status return parameter */
typedef struct {