Bluetooth: GATT: Remove dead code

This fixes the dead code when parsing Find Information response since
the index counter can never be zero, instead it checks there are any
attributes found and if there nothing don't proceed with discovering
which was the original intent of the now dead code.

Fixes #18384

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2019-08-19 11:26:27 +03:00 committed by Ioannis Glaropoulos
commit 2f91f1323d

View file

@ -2492,8 +2492,15 @@ static void gatt_find_info_rsp(struct bt_conn *conn, u8_t err,
goto done;
}
length--;
/* Check if there is a least one descriptor in the response */
if (length < len) {
goto done;
}
/* Parse descriptors found */
for (i = (length - 1) / len, pdu = rsp->info; i != 0;
for (i = length / len, pdu = rsp->info; i != 0;
i--, pdu = (const u8_t *)pdu + len) {
struct bt_gatt_attr *attr;
@ -2549,11 +2556,6 @@ static void gatt_find_info_rsp(struct bt_conn *conn, u8_t err,
}
}
/* Stop if could not parse the whole PDU */
if (i) {
goto done;
}
gatt_discover_next(conn, handle, params);
return;