nimble/host: Refactor GATT Read Multiple Variable Char Value response#2231
Open
sjanc wants to merge 1 commit into
Open
nimble/host: Refactor GATT Read Multiple Variable Char Value response#2231sjanc wants to merge 1 commit into
sjanc wants to merge 1 commit into
Conversation
MariuszSkamra
suggested changes
May 12, 2026
Comment on lines
-3404
to
+3416
| if (attr[i].om != NULL) { | ||
| os_mbuf_free_chain(attr[i].om); | ||
| } | ||
| os_mbuf_free_chain(attr[i].om); |
Contributor
There was a problem hiding this comment.
If the mbuf allocation fails in 3384, the attr[i].om will be NULL, or the buffer is dropped in 3402. I think the check should not be removed.
Contributor
Author
There was a problem hiding this comment.
os_mbuf_free_chain() handles NULL (just like free() does) on its own
| ble_gattc_error(status, att_handle), &attr[0], | ||
| i, | ||
| proc->read_mult.cb_arg); | ||
| ble_gattc_error(status, att_handle), &attr[0], |
Contributor
There was a problem hiding this comment.
The status set in 3406 (BLE_HS_EBADDATA) is passed to ble_gattc_error() function which is bad IMO.
Contributor
There was a problem hiding this comment.
Or maybe not. The ble_gattc_error() function name seems to be misleading.
7131f1b to
053c57b
Compare
MariuszSkamra
approved these changes
May 12, 2026
rymanluk
reviewed
May 12, 2026
| /* failed to correctly parse response, | ||
| * cleanup any partial data and set status if not set already | ||
| */ | ||
| if (i != proc->read_mult.num_handles || OS_MBUF_PKTLEN(*om) != 0) { |
Contributor
There was a problem hiding this comment.
nit: i < proc->read_mult.num_handles
rymanluk
approved these changes
May 12, 2026
This reworks ATT_READ_MULTIPLE_VARIABLE_RSP parsing. If response doesn't match request (number of values requested) or LV parsing shows incorrect format we ignore that and report error to app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reworks ATT_READ_MULTIPLE_VARIABLE_RSP parsing. If response doesn't match request (number of values requested) or LV parsing shows incorrect format we ignore that and report error to app.