Skip to content

Commit cff44ea

Browse files
carlescufijhedberg
authored andcommitted
Bluetooth: controller: Use sys_le16_to_cpu on all commands
To guarantee code that is endianness-independent, the sys_le* macros must be used everywhere when accessing multi-byte values from the command parameters. Signed-off-by: Carles Cufi <[email protected]>
1 parent 47dedfc commit cff44ea

File tree

1 file changed

+3
-3
lines changed
  • subsys/bluetooth/controller/hci

1 file changed

+3
-3
lines changed

subsys/bluetooth/controller/hci/hci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ static void set_ctl_to_host_flow(struct net_buf *buf, struct net_buf **evt)
239239
static void host_buffer_size(struct net_buf *buf, struct net_buf **evt)
240240
{
241241
struct bt_hci_cp_host_buffer_size *cmd = (void *)buf->data;
242+
u16_t acl_pkts = sys_le16_to_cpu(cmd->acl_pkts);
243+
u16_t acl_mtu = sys_le16_to_cpu(cmd->acl_mtu);
242244
struct bt_hci_evt_cc_status *ccst;
243-
u16_t acl_pkts = cmd->acl_pkts;
244-
u16_t acl_mtu = cmd->acl_pkts;
245245

246246
ccst = cmd_complete(evt, sizeof(*ccst));
247247

@@ -281,7 +281,7 @@ static void host_num_completed_packets(struct net_buf *buf,
281281

282282
/* leave *evt == NULL so no event is generated */
283283
for (i = 0; i < cmd->num_handles; i++) {
284-
count += cmd->h[i].count;
284+
count += sys_le16_to_cpu(cmd->h[i].count);
285285
}
286286

287287
hci_hbuf_acked += count;

0 commit comments

Comments
 (0)