Skip to content

Commit

Permalink
Bluetooth: L2CAP: document memset requirement
Browse files Browse the repository at this point in the history
The `struct bt_l2cap_le_chan` and `struct bt_l2cap_br_chan` objects
should be memset before passing them to the stack.

This was not stated anywhere, but all the in-tree users are doing it, so
it must be API.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
(cherry picked from commit e1ac386)
  • Loading branch information
jori-nordic authored and nashif committed Oct 15, 2024
1 parent 34a68c4 commit 02352b3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/zephyr/bluetooth/l2cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ struct bt_l2cap_server {
* This callback is called whenever a new incoming connection requires
* authorization.
*
* @warning It is the responsibility of this callback to zero out the
* parent of the chan object.
*
* @param conn The connection that is requesting authorization
* @param server Pointer to the server structure this callback relates to
* @param chan Pointer to received the allocated channel
Expand Down Expand Up @@ -516,6 +519,9 @@ int bt_l2cap_br_server_register(struct bt_l2cap_server *server);
* each channel connected() callback will be called. If the connection is
* rejected disconnected() callback is called instead.
*
* @warning It is the responsibility of the caller to zero out the
* parents of the chan objects.
*
* @param conn Connection object.
* @param chans Array of channel objects.
* @param psm Channel PSM to connect to.
Expand Down Expand Up @@ -551,6 +557,9 @@ int bt_l2cap_ecred_chan_reconfigure(struct bt_l2cap_chan **chans, uint16_t mtu);
* the location (address) of bt_l2cap_chan type object which is a member
* of both transport dedicated objects.
*
* @warning It is the responsibility of the caller to zero out the
* parent of the chan object.
*
* @param conn Connection object.
* @param chan Channel object.
* @param psm Channel PSM to connect to.
Expand Down

0 comments on commit 02352b3

Please sign in to comment.