shared/gatt-db: Fix gatt_db_attribute_get_index
Luiz Augusto von Dentz
maintainerPATCH 1/1 shared/gatt-db: Fix gatt_db_attribute_get_index
From: Luiz Augusto von Dentz <[email protected]>
gatt_db_attribute_get_index was calculating the index based on attrib->handle - service->attributes[0]->handle which doesn't work when there are gaps in between handles.
--- src/shared/gatt-db.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
src/shared/gatt-db.c +5 -5
@@ -1537,12 +1537,12 @@ static int gatt_db_attribute_get_index(struct gatt_db_attribute *attrib)return -1 ; service = attrib->service; - index = attrib->handle - service->attributes[0 ]->handle; - -if (index > (service->num_handles -1 )) -return -1 ; +for (index =0 ; index < service->num_handles; index++) { +if (service->attributes[index] == attrib) +return index; + } -return index; +return -1 ; } static struct gatt_db_attribute *
Signature · 1 line
2.35.1
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 9 lines · On Fri, 1 Apr 2022 14:38:57 -0700 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
gatt_db_attribute_get_indexwas calculating the index based onattrib->handle- service->attributes[0]->handle which doesn't work when there are gaps in between handles.[...]
Here is the summary with links:
- [BlueZ] shared/gatt-db: Fix gatt_db_attribute_get_index
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=234d60423c3b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=628334
---Test result---
Test Summary:
CheckPatch PASS 0.67 seconds GitLint PASS 0.46 seconds Prep - Setup ELL PASS 51.25 seconds Build - Prep PASS 0.66 seconds Build - Configure PASS 10.18 seconds Build - Make PASS 1848.64 seconds Make Check PASS 13.13 seconds Make Check w/Valgrind PASS 543.05 seconds Make Distcheck PASS 295.71 seconds Build w/ext ELL - Configure PASS 10.95 seconds Build w/ext ELL - Make PASS 1838.54 seconds Incremental Build with patchesPASS 0.00 seconds
---
Regards,
Linux Bluetooth