Skip to content

Conversation

jhedberg
Copy link
Member

@jhedberg jhedberg commented Aug 5, 2022

Clear pointer to the le_adv_recv() stack frame before returning to the
calling function. This fixes a potential compiler warning newer gcc
versions.

zephyr/subsys/bluetooth/host/scan.c: In function ‘le_adv_recv’:
zephyr/subsys/bluetooth/host/scan.c:463:20: error: storing the address
of local variable ‘id_addr’ in ‘*info.addr’ [-Werror=dangling-pointer=]
463 | info->addr = &id_addr;
| ~~~~~~~~~~~^~~~~~~~~~
zephyr/subsys/bluetooth/host/scan.c:439:22: note: ‘id_addr’ declared here
439 | bt_addr_le_t id_addr;
| ^~~~~~~

Fixes #48459

Signed-off-by: Johan Hedberg johan.hedberg@intel.com

Clear pointer to the le_adv_recv() stack frame before returning to the
calling function. This fixes a potential compiler warning newer gcc
versions.

zephyr/subsys/bluetooth/host/scan.c: In function ‘le_adv_recv’:
zephyr/subsys/bluetooth/host/scan.c:463:20: error: storing the address
of local variable ‘id_addr’ in ‘*info.addr’ [-Werror=dangling-pointer=]
  463 |         info->addr = &id_addr;
      |         ~~~~~~~~~~~^~~~~~~~~~
zephyr/subsys/bluetooth/host/scan.c:439:22: note: ‘id_addr’ declared here
  439 |         bt_addr_le_t id_addr;
      |                      ^~~~~~~

Fixes zephyrproject-rtos#48459

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
@carlescufi carlescufi merged commit 7ebaf1b into zephyrproject-rtos:main Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bluetooth: host: Dangling pointer in le_adv_recv

6 participants