Bluetooth: controller: Fix data length calculation in adv report

Max data length has to be adjusted for subevent code, otherwise we'll
hit an assert when trying to add data to event due to insufficient
free space.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This commit is contained in:
Andrzej Kaczmarek 2021-05-19 14:16:35 +02:00 committed by Carles Cufí
parent de974efebb
commit 9835888a91
1 changed files with 6 additions and 3 deletions

View File

@ -5070,8 +5070,9 @@ no_ext_hdr:
if (!data_status) {
uint8_t data_max_len;
data_max_len = ADV_REPORT_EVT_MAX_LEN - sizeof(*sep) -
sizeof(*adv_info);
data_max_len = ADV_REPORT_EVT_MAX_LEN -
sizeof(struct bt_hci_evt_le_meta_event) -
sizeof(*sep) - sizeof(*adv_info);
/* if data cannot fit the event, mark it as incomplete */
if (data_len > data_max_len) {
@ -5408,7 +5409,9 @@ no_ext_hdr:
if (!data_status) {
uint8_t data_max_len;
data_max_len = ADV_REPORT_EVT_MAX_LEN - sizeof(*sep);
data_max_len = ADV_REPORT_EVT_MAX_LEN -
sizeof(struct bt_hci_evt_le_meta_event) -
sizeof(*sep);
/* if data cannot fit the event, mark it as incomplete */
if (data_len > data_max_len) {