Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291052
b: refs/heads/master
c: 60fc5fb
h: refs/heads/master
v: v3
  • Loading branch information
Johan Hedberg committed Feb 23, 2012
1 parent 71f1e55 commit dc19930
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b3fb611ec7b76048cb14600e9a5a9b57e5d913da
refs/heads/master: 60fc5fb66efa0bcbe028637206ed59df8cd4ac19
14 changes: 7 additions & 7 deletions trunk/net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1725,8 +1725,8 @@ static int get_connections(struct sock *sk, u16 index)
struct hci_dev *hdev;
struct hci_conn *c;
size_t rp_len;
u16 count;
int i, err;
int err;
u16 i;

BT_DBG("");

Expand All @@ -1743,21 +1743,19 @@ static int get_connections(struct sock *sk, u16 index)
goto unlock;
}

count = 0;
i = 0;
list_for_each_entry(c, &hdev->conn_hash.list, list) {
if (test_bit(HCI_CONN_MGMT_CONNECTED, &c->flags))
count++;
i++;
}

rp_len = sizeof(*rp) + (count * sizeof(struct mgmt_addr_info));
rp_len = sizeof(*rp) + (i * sizeof(struct mgmt_addr_info));
rp = kmalloc(rp_len, GFP_ATOMIC);
if (!rp) {
err = -ENOMEM;
goto unlock;
}

put_unaligned_le16(count, &rp->conn_count);

i = 0;
list_for_each_entry(c, &hdev->conn_hash.list, list) {
if (!test_bit(HCI_CONN_MGMT_CONNECTED, &c->flags))
Expand All @@ -1769,6 +1767,8 @@ static int get_connections(struct sock *sk, u16 index)
i++;
}

put_unaligned_le16(i, &rp->conn_count);

/* Recalculate length in case of filtered SCO connections, etc */
rp_len = sizeof(*rp) + (i * sizeof(struct mgmt_addr_info));

Expand Down

0 comments on commit dc19930

Please sign in to comment.