Skip to content

Commit

Permalink
tests: bluetooth: tester: Fix GATT read multiple
Browse files Browse the repository at this point in the history
Pass only speficied number of handler to read_params for GATT read
multiple. This is to avoid sending invalid (zeros) handles in
ATT_READ_MULTIPLE_REQ.

This was affecting GATT/CL/GAR/BI-18-C and GATT/CL/GAR/BI-19-C
qualification test cases.

(cherry picked from commit 4f57614)

Original-Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
GitOrigin-RevId: 4f57614
Change-Id: Ia3732bc2e4f6e8ed066e2f6b9c3d8be2698b694d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4925687
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: Keith Short <keithshort@chromium.org>
  • Loading branch information
sjanc authored and Chromeos LUCI committed Oct 10, 2023
1 parent 349d4ed commit 42d9cbc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/bluetooth/tester/src/btp_gatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1651,11 +1651,11 @@ static uint8_t read_multiple(const void *cmd, uint16_t cmd_len,
return BTP_STATUS_FAILED;
}

if (cp->handles_count > ARRAY_SIZE(handles)) {
if (cp->handles_count == 0 || cp->handles_count > ARRAY_SIZE(handles)) {
return BTP_STATUS_FAILED;
}

for (i = 0; i < ARRAY_SIZE(handles); i++) {
for (i = 0; i < cp->handles_count; i++) {
handles[i] = sys_le16_to_cpu(cp->handles[i]);
}

Expand All @@ -1670,7 +1670,7 @@ static uint8_t read_multiple(const void *cmd, uint16_t cmd_len,
}

read_params.func = read_cb;
read_params.handle_count = i;
read_params.handle_count = cp->handles_count;
read_params.multiple.handles = handles; /* not used in read func */
read_params.multiple.variable = false;
read_params.chan_opt = BT_ATT_CHAN_OPT_NONE;
Expand Down

0 comments on commit 42d9cbc

Please sign in to comment.