Bluetooth: ATT: Fix ATT_CHAN() macro

ATT_CHAN() macro as a wrapper to CONTAINER_OF is been used by ATT
internals API wherein the main parameter is pointer to bt_l2cap_chan
object. The macro returns pointer to bt_att context object but
CONTAINER_OF's third parameter determines what member is taken into
account in getting right address. Luckily here this third parameter
"chan" of type bt_l2cap_le_chan got of its own sub-member the "chan" of
type bt_l2cap_chan on first position in structure order. If such order
would change somehow there could be taken wrong address.

Change-Id: I955c2af11e001dac90a1eacc281ff167ceb34fb9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2016-07-05 15:55:03 +02:00
commit fdfc92c80d

View file

@ -45,7 +45,7 @@
#define BT_DBG(fmt, ...) #define BT_DBG(fmt, ...)
#endif #endif
#define ATT_CHAN(_ch) CONTAINER_OF(_ch, struct bt_att, chan) #define ATT_CHAN(_ch) CONTAINER_OF(_ch, struct bt_att, chan.chan)
#define BT_GATT_PERM_READ_MASK (BT_GATT_PERM_READ | \ #define BT_GATT_PERM_READ_MASK (BT_GATT_PERM_READ | \
BT_GATT_PERM_READ_ENCRYPT | \ BT_GATT_PERM_READ_ENCRYPT | \