-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Bluetooth: BAP: Ep check fixes #95605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b12a603 to
c9e4bbe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors endpoint check functions in the Bluetooth BAP subsystem to have more descriptive names and be more strict in their validation. The changes replace generic "is_" function names with more specific "has_ep" naming conventions and add a missing function for unicast server endpoint validation.
- Renamed endpoint check functions from
bt_bap_ep_is_*tobt_bap_*_has_eppattern for better clarity - Added missing
bt_bap_unicast_server_has_epfunction and correspondingbt_ascs_has_epimplementation - Made endpoint validation more strict by adding proper checks for invalid endpoints
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c | Updated function name and return value in test stub |
| tests/bluetooth/audio/ascs/uut/bap_unicast_client.c | Updated function name in test stub |
| subsys/bluetooth/audio/bap_unicast_server.c | Added new bt_bap_unicast_server_has_ep function |
| subsys/bluetooth/audio/bap_unicast_client.c | Renamed function from bt_bap_ep_is_unicast_client to bt_bap_unicast_client_has_ep |
| subsys/bluetooth/audio/bap_stream.c | Updated function calls to use new naming convention and added strict endpoint validation |
| subsys/bluetooth/audio/bap_iso.c | Updated function calls to use new naming convention |
| subsys/bluetooth/audio/bap_internal.h | Added function declarations for the new endpoint check functions |
| subsys/bluetooth/audio/bap_endpoint.h | Removed old function declarations |
| subsys/bluetooth/audio/bap_broadcast_source.c | Renamed function and fixed array check macro |
| subsys/bluetooth/audio/bap_broadcast_sink.c | Renamed function and fixed array check macro |
| subsys/bluetooth/audio/ascs_internal.h | Added bt_ascs_has_ep function declaration |
| subsys/bluetooth/audio/ascs.c | Added implementation of bt_ascs_has_ep function |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
c9e4bbe to
d6594e8
Compare
d6594e8 to
988403a
Compare
subsys/bluetooth/audio/ascs.c
Outdated
| bool bt_ascs_has_ep(const struct bt_bap_ep *ep) | ||
| { | ||
| return PART_OF_ARRAY(ascs.ase_pool, ep); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate of bool bt_ascs_is_ase_ep(const struct bt_bap_ep *ep) (line 1450)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it is - Thanks for spotting this
We check for all other roles when checking whether an endpoint can send or receive, except for the unicast server. It is technically implied, but if the ep is not a valid pointer, then we may access invalid memory. Add check for bt_bap_ep_is_unicast_server (which uses the new bt_ascs_has_ep function). Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Rename the bt_bap_is_x_ep functions to better match the modules where they are implemented. Additionally modify the check to use IS_ARRAY_ELEMENT in the broadcast sink and source for a stricter check. IS_ARRAY_ELEMENT cannot easily be used in the unicast client and server, as the endpoints are part of another structure. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
988403a to
8dbb366
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|



Modify the ep check functions to have better names and to be more strict, as well as adding a missing function.