Bluetooth: GATT: Fix unaligned accesses

Use net_buf helper whenever accessing data by reference.

Change-Id: I3c7eb3af33a3d22741f73c094fb4a39e3e3d3440
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2016-09-03 11:51:53 +03:00 committed by Johan Hedberg
commit 4f418a6b42

View file

@ -1176,7 +1176,6 @@ static int att_read_type(struct bt_conn *conn,
{
struct net_buf *buf;
struct bt_att_read_type_req *req;
uint16_t *value;
buf = bt_att_create_pdu(conn, BT_ATT_OP_READ_TYPE_REQ, sizeof(*req));
if (!buf) {
@ -1187,11 +1186,10 @@ static int att_read_type(struct bt_conn *conn,
req->start_handle = sys_cpu_to_le16(params->start_handle);
req->end_handle = sys_cpu_to_le16(params->end_handle);
value = net_buf_add(buf, sizeof(*value));
if (params->type == BT_GATT_DISCOVER_INCLUDE)
*value = sys_cpu_to_le16(BT_UUID_GATT_INCLUDE_VAL);
net_buf_add_le16(buf, BT_UUID_GATT_INCLUDE_VAL);
else
*value = sys_cpu_to_le16(BT_UUID_GATT_CHRC_VAL);
net_buf_add_le16(buf, BT_UUID_GATT_CHRC_VAL);
BT_DBG("start_handle 0x%04x end_handle 0x%04x", params->start_handle,
params->end_handle);