Skip to content

Conversation

@zephyrbot
Copy link

@zephyrbot zephyrbot commented Aug 12, 2024

Backport ee08327 from #76885.

Fixes #76912

gcc 13 produces a build warning (see below), as it seems to
believe the number of read bytes may overflow the frame_size
type.
Let's increase the frame_size bitwidth to avoid this.
(Any 32bit type, signed or unsigned, avoids this warning)

The build warning:
```
In file included from /usr/include/features.h:502,
                 from bits/libc-header-start.h:33,
                 from /usr/include/stdint.h:26,
                 from include/stdint.h:9,
                 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
      |                ^~~~~~~~~~~~~~~~~~
```

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
(cherry picked from commit ee08327)
@zephyrbot zephyrbot requested a review from alwa-nordic as a code owner August 12, 2024 10:43
@zephyrbot zephyrbot added the Backport Backport PR and backport failure issues label Aug 12, 2024
@zephyrbot zephyrbot added area: Bluetooth size: XS A PR changing only a single line of code area: Bluetooth Host Bluetooth Host (excluding BR/EDR) labels Aug 12, 2024
@aescolar aescolar added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label Aug 12, 2024
@nashif nashif merged commit 37cea05 into v3.7-branch Aug 16, 2024
@nashif nashif deleted the backport-76885-to-v3.7-branch branch August 16, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth Backport Backport PR and backport failure issues size: XS A PR changing only a single line of code Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants