Description
Describe the bug
drivers/bluetooth/hci/userchan.c builds with a warning w gcc13,
as it seems to believe the number of read bytes may overflow the frame_size type.
Note gcc 13 is the default w Ubuntu 24.04
To Reproduce
Steps to reproduce the behavior (w gcc 13)
- mkdir build; cd build
- cmake -GNinja -DBOARD=native_sim ../samples/hello_world/ -DCONFIG_BT=y
- ninja
- See error
Expected behavior
No build warning
Impact
Failing twister tests (~20), build warning when using this driver
Logs and console output
In file included from ...
from zephyr/include/zephyr/types.h:11,
from zephyr/include/zephyr/kernel_includes.h:21,
from zephyr/include/zephyr/kernel.h:17,
from zephyr/drivers/bluetooth/hci/userchan.c:9:
In function ‘read’,
inlined from ‘rx_thread’ at drivers/bluetooth/hci/userchan.c:201:9: /usr/include/i386-linux-gnu/bits/unistd.h:28:10: warning: ‘__read_alias’ specified size between 4294902273 and 4294967295 exceeds maximum object size 2147483647 [-Wstringop-overflow=]
28 | return __glibc_fortify (read, __nbytes, sizeof (char),
| ^~~~~~~~~~~~~~~
drivers/bluetooth/hci/userchan.c: In function ‘rx_thread’: drivers/bluetooth/hci/userchan.c:187:32: note: destination object allocated here
187 | static uint8_t frame[512];
| ^~~~~
/usr/include/i386-linux-gnu/bits/unistd-decl.h:29:16: note: in a call to function ‘__read_alias’ declared with attribute ‘access (write_only, 2, 3)’
29 | extern ssize_t __REDIRECT_FORTIFY (__read_alias, (int __fd, void *__buf,
| ^~~~~~~~~~~~~~~~~~
Environment (please complete the following information):
- OS: Linux, Ubuntu 24.04
- Toolchain: Host gcc 13
- Commit SHA or Version used: main as of now a747d1a