Message ID | 20220401213857.36738-1-luiz.dentz@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 234d60423c3b8186a27b31028d4c0acb847eedb1 |
Headers | show |
Series | [BlueZ] shared/gatt-db: Fix gatt_db_attribute_get_index | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/checkpatch | success | Checkpatch PASS |
tedd_an/gitlint | success | Gitlint PASS |
tedd_an/setupell | success | Setup ELL PASS |
tedd_an/buildprep | success | Build Prep PASS |
tedd_an/build | success | Build Configuration PASS |
tedd_an/makecheck | success | Make Check PASS |
tedd_an/makecheckvalgrind | success | Make Check PASS |
tedd_an/makedistcheck | success | Make Distcheck PASS |
tedd_an/build_extell | success | Build External ELL PASS |
tedd_an/build_extell_make | success | Build Make with External ELL PASS |
Hello: This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Fri, 1 Apr 2022 14:38:57 -0700 you wrote: > From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> > > 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. > > Fixes: https://github.com/bluez/bluez/issues/326 > > [...] 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!
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
diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c index be07cdbe4..4f5d10b57 100644 --- a/src/shared/gatt-db.c +++ b/src/shared/gatt-db.c @@ -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 *
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> 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. Fixes: https://github.com/bluez/bluez/issues/326 --- src/shared/gatt-db.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)