git: 72a6991b80c6 - main - bluetooth: Don't use a non-string to initialize NG_HCI_BDADDR_ANY
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 27 Jan 2026 18:41:04 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=72a6991b80c6e6c47a3b84337f62f0a02bd30391
commit 72a6991b80c6e6c47a3b84337f62f0a02bd30391
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-01-27 18:40:38 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-01-27 18:40:38 +0000
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
---
sys/netgraph/bluetooth/include/ng_hci.h | 4 ++--
1 file 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 {